2021-01-17 02:20:03 +03:00
|
|
|
#r "nuget: AngleSharp, 1.0.0-alpha-844"
|
|
|
|
|
|
|
|
using System.Linq;
|
2024-12-02 21:29:34 +03:00
|
|
|
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);
|
2021-01-17 02:20:03 +03:00
|
|
|
|
|
|
|
System.Console.Out.WriteLine(
|
2021-01-17 05:03:43 +03:00
|
|
|
"downloads(" + System.Text.Json.JsonSerializer.Serialize(
|
2024-12-02 21:29:34 +03:00
|
|
|
new HtmlParser()
|
2021-01-17 02:20:03 +03:00
|
|
|
.ParseDocument(
|
2024-12-02 21:29:34 +03:00
|
|
|
await client
|
2021-01-17 02:20:03 +03:00
|
|
|
.GetStringAsync("https://www.sourcetreeapp.com/download-archives")
|
|
|
|
.ConfigureAwait(false))
|
2021-01-17 04:56:24 +03:00
|
|
|
.QuerySelectorAll(".wpl tr div>a")
|
2024-12-02 21:29:34 +03:00
|
|
|
.Select(row => new { Version = row.TextContent.Trim(), ZipUrl = row.GetAttribute("href") })
|
2021-01-17 02:20:03 +03:00
|
|
|
.ToArray()) + ")"
|
|
|
|
);
|