Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Last active March 9, 2017 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrateekKumarSingh/358fd81b8c939c6de29237024cae4e4c to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/358fd81b8c939c6de29237024cae4e4c to your computer and use it in GitHub Desktop.
Function Get-UsersOnlineOnReddit
{
$OnlineUsers = (Invoke-WebRequest https://www.reddit.com/r/PowerShell/).ParsedHtml.all | `
Where-Object{ $_.classname -eq "users-online fuzzed" } | `
ForEach-Object {
($_.innertext -split " " -replace "~","")[0]
}
If($OnlineUsers)
{
''|Select-Object @{n='Timestamp';e={(Get-Date).DateTime}},@{n='OnlineUsers';e={"$OnlineUsers"}} |`
Export-Csv C:\Data\RedditUsersTrend.csv -Append -NoTypeInformation
}
}
#$i = 1
#0..500|ForEach-Object{
# Get-UsersOnlineOnReddit
# Start-Sleep -Seconds 600
# Write-Host "$i values recorded"
# $i = $i + 1
#}
#Clear-Host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment