public static void Main(string[] args) { var conn = new ConnectSQL(); ConnectSQL.Connect("mysql-Username", "mysql-Password"); var scrape = new scrape(); var results = scrape.scraper(); foreach (var stock in results) { Console.WriteLine(stock); } }
public async Task <IActionResult> OnPostAsync() { //Check to see if user selected any prefilled site info: if (!String.IsNullOrEmpty(prefilledSite)) { _logger.LogInformation($"Using pre-filled info:{prefilledSite}"); var siteData = new FormattedSites(); siteData.formattedSitesDict.TryGetValue(prefilledSite, out List <string> priceNamesList); Console.WriteLine($"FOUND: {priceNamesList[0]}+ {priceNamesList[1]}"); //When using prefilled info, it's always in the same order: price, name priceId = priceNamesList[0]; productNameId = priceNamesList[1]; } var productMeta = new ProductMeta { ProductUrl = url, PriceHtmlId = priceId, NameHtmlId = productNameId, VanityName = vanityName }; try { //Save changes to database and scrape the newly added product. _context.ProductMeta.Add(productMeta); await _context.SaveChangesAsync(); scrape scraper = new scrape(_context); scraper.ScrapeSingle(productMeta.ProductUrl, productMeta.PriceHtmlId, productMeta.NameHtmlId, productMeta.Id, _context); } catch (Exception e) { _logger.LogWarning(e, "Error Saving to database:"); } return(RedirectToPage("SavedProducts")); }
assertTrue(scrape.list.get("title").data.indexOf("<title>") > 0);
AssertEquals(scrape.list.get("title").type, "text");
AssertEquals(scrape.address, "http://localhost:9090/");
AssertEquals(scrape.section, "one");