Example #1
0
        public static void Main(string[] args)
        {
            using (ReaderService rdr = new ReaderService("username", "password", "Sandworks.Google.App"))
            {
                var o = rdr.Search("Sony Hdtv", "100");
                Console.WriteLine(o);
            }

            Console.Read();
        }
Example #2
0
 public IEnumerable<RawDealItem> GetDeals(string product, int count)
 {
     List<RawDealItem> results = new List<RawDealItem>();
     using (ReaderService rdr = new ReaderService(UserName, Password, Source))
     {
         var resultsXml = rdr.Search(product, (count * 2).ToString());
         XNamespace xmlns = "http://www.w3.org/2005/Atom";
         if(!string.IsNullOrWhiteSpace(resultsXml))
             results = XElement.Parse(resultsXml).Elements(xmlns + "entry").Select(o => new RawDealItem(o, xmlns)).ToList<RawDealItem>();
     }
     return results.Distinct<RawDealItem>(new DealItemComparer()).Take(count);
 }
Example #3
0
        public static void Main2(string[] args)
        {
            // Empty line.
            Console.WriteLine("");

            // Get username.
            Console.Write(" Enter your Google username: "******"username", "password", "Sandworks.Google.App");
            {

                string[] lines = System.IO.File.ReadAllLines(@"C:\Users\sumant\desktop\deallinks.txt");

                int count = 0;
                Parallel.ForEach(lines.Distinct(), (line) =>
                {

                    lock (obj)
                        Console.WriteLine("Processing line: " + count++);

                    if (!line.Contains("technorati"))
                    {
                        try
                        {
                            {
                                rdr.AddSubscription(line);
                                Console.WriteLine("Subscription Added: " + line);
                            }
                        }
                        catch (Exception ex)
                        {
                            rdr = new ReaderService("username", "password", "Sandworks.Google.App");
                            Console.WriteLine("************Failed********" + " " + line);
                        }
                    }

                });

            }

            // Pause.
            Console.ReadLine();
        }
Example #4
0
        static void Main2(string[] args)
        {
            string url = "http://www.alvinashcraft.com/";
            int month = 1;
            int maxPageNumber = 10;
            List<string> feedLinks = new List<string>();

            List<string> allPageLinks = new List<string>();
            while (month < 13)
            {
                for (int i = 1; i <= maxPageNumber; i++)
                {
                    string link = string.Format(@"http://www.alvinashcraft.com/2011/{0}/page/{1}", month, i);
                    allPageLinks.Add(link);
                }
                month++;
            }

            Parallel.ForEach(allPageLinks, (link) => {

                Console.WriteLine("Processing link: " + link);

                HtmlWeb web = new HtmlWeb();
                HtmlDocument document = web.Load(link);

                // Get the Daily Posts
                if (document != null && document.DocumentNode != null)
                {
                    if (!document.DocumentNode.InnerHtml.Contains("404 - Not Found"))
                    {
                        HtmlNodeCollection dailyPost = document.DocumentNode.SelectNodes(("//div[@class='post-entry']"));
                        if (dailyPost != null && dailyPost.Count > 0)
                        {
                            foreach (HtmlNode post in dailyPost)
                            {
                                foreach (string linkUrl in HTMLHelper.GetLinksFromHTML(post.InnerHtml))
                                {
                                    if (!(linkUrl.Contains("del.icio.us") || linkUrl.Contains("amazon.com") || linkUrl.Contains("alvinash")))
                                    {
                                        feedLinks.Add(linkUrl);
                                    }
                                }
                            }
                        }
                    }
                }

            });

            //foreach (string link in allPageLinks)
            //{
            //    Console.WriteLine("Processing link: " + link);

            //    HtmlWeb web = new HtmlWeb();
            //    HtmlDocument document = web.Load(link);

            //    // Get the Daily Posts
            //    if (document != null && document.DocumentNode != null)
            //    {
            //        if (document.DocumentNode.InnerHtml.Contains("404 - Not Found"))
            //            continue;

            //        HtmlNodeCollection dailyPost = document.DocumentNode.SelectNodes(("//div[@class='post-entry']"));
            //        if (dailyPost != null && dailyPost.Count > 0)
            //        {
            //            foreach (HtmlNode post in dailyPost)
            //            {
            //                foreach (string linkUrl in HTMLHelper.GetLinksFromHTML(post.InnerHtml))
            //                {
            //                    if (!(linkUrl.Contains("del.icio.us") || linkUrl.Contains("amazon.com") || linkUrl.Contains("alvinash")))
            //                        feedLinks.Add(linkUrl);
            //                }
            //            }
            //        }
            //    }
            //}

            System.IO.File.WriteAllLines(@"C:\Users\sumant\desktop\subscriptions.txt", feedLinks.ToArray());

            //HtmlWeb web = new HtmlWeb();
            //HtmlDocument document = web.Load(url);
            //List<string> feedLinks = new List<string>();
            //if (document != null && document.DocumentNode != null)
            //{
            //    HtmlNodeCollection dailyPost = document.DocumentNode.SelectNodes(("//div[@class='post-entry']"));
            //    if (dailyPost != null && dailyPost.Count > 0)
            //    {
            //        foreach (HtmlNode post in dailyPost)
            //        {
            //            foreach (string link in HTMLHelper.GetLinksFromHTML(post.InnerHtml))
            //            {
            //                if (!(link.Contains("del.icio.us") || link.Contains("amazon.com") || link.Contains("alvinash")))
            //                    feedLinks.Add(link);
            //            }
            //        }
            //    }
            //}

            // Subscribe to links now.
            using (ReaderService rdr = new ReaderService("username", "password", "Sandworks.Google.App"))
            {
                List<Subscription> s = rdr.GetSubscriptions();
                foreach (string link in feedLinks)
                {
                    try
                    {
                        {
                            //rdr.AddSubscription(link);
                            Console.WriteLine("Subscription Added: " + link);
                        }
                    }
                    catch
                    {
                        Console.WriteLine("************Failed********" + " " + link);
                    }
                }

            }

            Console.Read();
        }