Created
October 10, 2021 11:08
-
-
Save matt40k/f952bf5209560da3cbba1d7c2321ff32 to your computer and use it in GitHub Desktop.
PowerQuery M code for scrapping the Raspberry PI image stats
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
let | |
Source = Web.BrowserContents("https://rpi-imager-stats.raspberrypi.org"), | |
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "DIV.row:nth-child(3) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR > :nth-child(1)"}, {"Column2", "DIV.row:nth-child(3) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR > :nth-child(2)"}}, [RowSelector="DIV.row:nth-child(3) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR"]), | |
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]), | |
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Image", type text}, {"Percentage", Percentage.Type}}), | |
#"Add Timestamp" = Table.AddColumn(#"Changed Type", "Timestamp", each DateTime.LocalNow(), type datetime) | |
in | |
#"Add Timestamp" |
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
let | |
Source = Web.BrowserContents("https://rpi-imager-stats.raspberrypi.org"), | |
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "DIV.row:nth-child(2) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR > :nth-child(1)"}, {"Column2", "DIV.row:nth-child(2) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR > :nth-child(2)"}}, [RowSelector="DIV.row:nth-child(2) > DIV.col-sm:nth-child(1) > TABLE.table.mt-4 > * > TR"]), | |
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]), | |
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Operating System", type text}, {"Percentage", Percentage.Type}}), | |
#"Add Timestamp" = Table.AddColumn(#"Changed Type", "Timestamp", each DateTime.LocalNow(), type datetime) | |
in | |
#"Add Timestamp" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment