Skip to content

Commit

Permalink
Updated nuget packages version
Browse files Browse the repository at this point in the history
  • Loading branch information
VAllens committed Apr 26, 2019
1 parent a77eb99 commit e9da513
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/CrawlerSamples.ConsoleApp/CrawlerSamples.ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>7.1</LangVersion>
<RootNamespace>CrawlerSamples</RootNamespace>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>7.1</LangVersion>
<RootNamespace>CrawlerSamples</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AngleSharp" Version="0.9.9.2" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="PuppeteerSharp" Version="1.0.2" />
<PackageReference Include="AngleSharp" Version="0.11.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="PuppeteerSharp" Version="1.14.0" />
</ItemGroup>

</Project>
13 changes: 7 additions & 6 deletions src/CrawlerSamples.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading.Tasks;
using AngleSharp;
using AngleSharp.Dom;
using AngleSharp.Parser.Html;
using AngleSharp.Html.Parser;
using Newtonsoft.Json;
using PuppeteerSharp;

Expand All @@ -15,12 +15,12 @@ namespace CrawlerSamples
internal class Program
{
private const string Url = "https://store.mall.autohome.com.cn/83106681.html";
private const int ChromiumRevision = Downloader.DefaultRevision;
private const int ChromiumRevision = BrowserFetcher.DefaultRevision;

private static async Task Main(string[] args)
{
//Download chromium browser revision package
await Downloader.CreateDefault().DownloadRevisionAsync(ChromiumRevision);
await new BrowserFetcher().DownloadAsync(ChromiumRevision);

//Test AngleSharp
await TestAngleSharp();
Expand All @@ -45,8 +45,9 @@ private static async Task TestAngleSharp()
/*
* Parsing of HTML document string
*/
var parser = new HtmlParser(Configuration.Default);
var document = parser.Parse(htmlString);
var context = BrowsingContext.New(Configuration.Default);
var parser = context.GetService<IHtmlParser>();
var document = parser.ParseDocument(htmlString);

//Selector carbox element list
var carboxList = document.QuerySelectorAll("div.shop-content div.content div.list li.carbox");
Expand All @@ -72,7 +73,7 @@ private static async Task<string> TestPuppeteerSharp()
//Enabled headless option
var launchOptions = new LaunchOptions { Headless = true };
//Starting headless browser
var browser = await Puppeteer.LaunchAsync(launchOptions, ChromiumRevision);
var browser = await Puppeteer.LaunchAsync(launchOptions);

//New tab page
var page = await browser.NewPageAsync();
Expand Down

0 comments on commit e9da513

Please sign in to comment.