Advertisement
Guest User

Untitled

a guest
Mar 4th, 2014
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Get-TwitchBroadcasts($channel) {
  2.     $limit = 100
  3.     $total = Invoke-WebRequest "https://api.twitch.tv/kraken/channels/$channel/videos?broadcasts=true" | Select-Object -ExpandProperty Content | ConvertFrom-Json | Select-Object -ExpandProperty _total
  4.     $videos = @()
  5.     for ($offset = 0; $offset -lt $total; $offset += $limit) {
  6.         $videos += Invoke-WebRequest "https://api.twitch.tv/kraken/channels/$channel/videos?broadcasts=true&offset=$offset&limit=$limit" | Select-Object -ExpandProperty Content | ConvertFrom-Json | Select-Object -ExpandProperty videos
  7.     }
  8.     $videos | Select-Object title, url | ConvertTo-Html | Set-Content "$channel.html"
  9. }
  10.  
  11. Get-TwitchBroadcasts("tornis")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement