-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5478bd3
commit cf68a3a
Showing
2 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
#r "nuget: AngleSharp, 1.0.0-alpha-844" | ||
|
||
using System.Linq; | ||
using System.Net.Http; | ||
using AngleSharp.Html.Parser; | ||
|
||
string userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0"; | ||
|
||
var client = new HttpClient(); | ||
client.DefaultRequestHeaders.UserAgent.ParseAdd(userAgent); | ||
|
||
System.Console.Out.WriteLine( | ||
"downloads(" + System.Text.Json.JsonSerializer.Serialize( | ||
new AngleSharp.Html.Parser.HtmlParser() | ||
new HtmlParser() | ||
.ParseDocument( | ||
await new System.Net.Http.HttpClient() | ||
await client | ||
.GetStringAsync("https://www.sourcetreeapp.com/download-archives") | ||
.ConfigureAwait(false)) | ||
.QuerySelectorAll(".wpl tr div>a") | ||
.Select(row => new { Version = row.TextContent, ZipUrl = row.GetAttribute("href") }) | ||
.Select(row => new { Version = row.TextContent.Trim(), ZipUrl = row.GetAttribute("href") }) | ||
.ToArray()) + ")" | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters