コード例 #1
0
        private ICollection <ScrapedUser> GetResultsFromScraping(IScrapingMethod scrapingStrategy, List <string> listOfURLs)
        {
            List <ScrapedUser> scrapeListResult = null;

            try
            {
                var driver = new InstaTool.MainScripts.InstagramPages.Login();
                driver.PerformLogin(Login.LoggedAccount);

                scrapeListResult = scrapingStrategy.Scrape(listOfURLs, driver.InstaDriver).ToList();

                if (scrapeListResult.Count != 0)
                {
                    LogHelper.Log($"Scraped a number of {scrapeListResult.Count} users");
                    LogHelper.Log($"Scraped users are available to export in the dropdown below");
                }
                else
                {
                    LogHelper.Log($"{scrapeListResult.Count} users scraped");
                }
            }
            catch (Exception ex) { }

            return(scrapeListResult);
        }
コード例 #2
0
 private void StartScrape(FollowSpecifications fSpecs)
 {
     if (UrlIsValid())
     {
         if (FollowersFollowingValuesAreCorrect())
         {
             ThreadHelperClass.SetText(this, statusLabel, "Running...");
             var ig       = new InstaTool.MainScripts.InstagramPages.Login();
             var homepage = ig.PerformLogin(_accountInUse.EmailPhone);
             ThreadHelperClass.SetText(this, statusLabel, "Logged in...");
             var userProfile = homepage.GoToUserProfile(instagramTargetUrl.Text, true);
             ThreadHelperClass.SetText(this, statusLabel, "Started scraping...be patient");
             _scrapedUsers = userProfile.ScrapeUsersByStrategy(1, new ScrapeByNumberOfFollowers(fSpecs));
             ThreadHelperClass.SetText(this, statusLabel, "Scraping done!!");
         }
     }
 }