Skip to content

Instantly share code, notes, and snippets.

@altbodhi
Created June 9, 2026 12:25
Show Gist options
  • Select an option

  • Save altbodhi/4841ed36a6f0444346420b6a323be36b to your computer and use it in GitHub Desktop.

Select an option

Save altbodhi/4841ed36a6f0444346420b6a323be36b to your computer and use it in GitHub Desktop.
Simplest way grab and visualization data from web
(*
run it in cmd via dotnet fsi lh.fsx
and be happy!
*)
#r "nuget: FSharp.Data"
#r "nuget: XPlot.Plotly"
#r "nuget: System.Text.Encoding.CodePages"
open XPlot.Plotly
open FSharp.Data
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance)
System.Text.Encoding.GetEncoding(1251)
let url = "https://www.roscosmos.ru/launch/2026/"
let xd = HtmlDocument.Load(url, System.Text.Encoding.GetEncoding(1251))
let periods =
xd.CssSelect(".launch-years > div.wrapper > a")
|> List.map (fun x -> x.AttributeValue("href"))
let rec fetch_launch xs acc =
match xs with
| [] -> acc
| h :: t ->
printfn $"{h}"
let xd =
HtmlDocument.Load($"https://www.roscosmos.ru{h}", System.Text.Encoding.GetEncoding(1251))
let year =
xd.CssSelect("table > tbody > tr > td > p > span.date")
|> List.map (fun x -> x.InnerText() |> System.DateTime.Parse)
fetch_launch t (acc @ year)
let launchs = fetch_launch periods []
launchs
|> List.groupBy (fun x -> x.Year)
|> List.map (fun (y, xs) -> (y, xs.Length))
|> List.sortBy fst
|> Chart.Column
|> Chart.WithTitle("Пуски")
|> Chart.WithSize(800, 480)
|> Chart.Show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment