dags att checka in
This commit is contained in:
12
AngleSharpTest/AngleSharpTest.csproj
Normal file
12
AngleSharpTest/AngleSharpTest.csproj
Normal file
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AngleSharp" Version="0.16.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
25
AngleSharpTest/Program.cs
Normal file
25
AngleSharpTest/Program.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using AngleSharp;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace AngleSharpTest
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
var config = Configuration.Default.WithDefaultLoader();
|
||||
var address = "https://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes";
|
||||
var context = BrowsingContext.New(config);
|
||||
var document = await context.OpenAsync(address);
|
||||
var cellSelector = "tr.vevent td:nth-child(3)";
|
||||
var cells = document.QuerySelectorAll(cellSelector);
|
||||
var titles = cells.Select(m => m.TextContent);
|
||||
foreach (var title in titles)
|
||||
{
|
||||
Console.WriteLine(title.ToString()); ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user