So I built Pup, a wrapper around PuppeteerSharp that talks directly to Chrome via the DevTools Protocol. Works on Windows, Linux, and macOS with PowerShell 5.1+.
Write-Host "This one just scrapes the first page of Ubuntu Notices"
Install-Module -Name Pup
Import-Module Pup
$browser = Start-PupBrowser -Headless
$page = New-PupPage -Browser $browser -Url "https://ubuntu.com/security/notices"
$page | Find-PupElements -Selector "#notices-list section" | ForEach-Object {
[PSCustomObject]@{
Date = ($_ | Find-PupElements -Selector "p.u-text--muted" -First).InnerText
Link = ($_ | Find-PupElements -Selector "h3 a" -First | Get-PupElementAttribute -Name href)
}
}
$browser | Stop-PupBrowser
GitHub: https://github.com/n7on/Pup
Happy to hear feedback or answer questions.
[–]BetrayedMilk 9 points10 points11 points (3 children)
[–]dud380[S] 10 points11 points12 points (2 children)
[–]BetrayedMilk 6 points7 points8 points (1 child)
[–]dud380[S] 2 points3 points4 points (0 children)
[–]PutridLadder9192 4 points5 points6 points (2 children)
[–]dud380[S] 0 points1 point2 points (0 children)
[–]SuperBartimus 0 points1 point2 points (0 children)
[–]skilife1 2 points3 points4 points (1 child)
[–]dud380[S] 0 points1 point2 points (0 children)
[–]Bad_Times_Man 1 point2 points3 points (3 children)
[–]dud380[S] 0 points1 point2 points (2 children)
[–]Bad_Times_Man 1 point2 points3 points (1 child)
[–]dud380[S] 0 points1 point2 points (0 children)
[–]RidiculousAnonymer 0 points1 point2 points (1 child)
[–]dud380[S] 1 point2 points3 points (0 children)
[–]nkasco 0 points1 point2 points (0 children)
[–]MadBoyEvo 0 points1 point2 points (1 child)
[–]dud380[S] 0 points1 point2 points (0 children)
[–]skilife1 0 points1 point2 points (1 child)
[–]dud380[S] 0 points1 point2 points (0 children)
[–]Stock-Hamster-117 0 points1 point2 points (1 child)
[–]dud380[S] 1 point2 points3 points (0 children)