Last active
March 9, 2017 09:53
-
-
Save PrateekKumarSingh/358fd81b8c939c6de29237024cae4e4c to your computer and use it in GitHub Desktop.
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
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