Querying Pottermore

Here is a powershell script for finding new articles on pottermore:

Save this as pm-history.ps1:

==============================

[xml]$data = (invoke-webrequest -uri https://www.pottermore.com/sitemap.xml | select Content).content

$date = [DateTime]::Today.ToString(“yyyyMMdd”)

$data.urlset.url.loc | sort > “Pottermore$($date).csv”

$data.urlset.url.loc | % { ($_ -split “/”)[3] } | group | where Name -ne “” | sort Count -Descending | select Name,Count | Export-Csv -NoTypeInformation -Path “Pottermore_Stats_$($date).csv”

 

To use it open powershell in the directory it is in and use:

 

.\pm-history.ps1

 

Once you have more than one days data then you can easily get the difference between dates:

compare-object (gc .\Pottermore20151207.csv) (gc .\pottermore20151206.csv)

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s