PoshCode Archive  Artifact [a1698147c4]

Artifact a1698147c4d77b58ead0bd91508a28918d25719fce42559f5de1a62fd6529629:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [eb540d6a78] at 2018-06-10 13:44:51 on branch trunk — The Division (user: 098Hill size: 829)

# encoding: ascii
# api: powershell
# title: Get Twitter RSS Feed
# description: The Division
# version: 0.1
# author: 098Hill
# license: CC0
# x-poshcode-id: 4701
# x-archived: 2013-12-16T12:36:18
# x-published: 2013-12-14T04:46:00
#
#
param ([String] $ScreenName)

$client = New-Object System.Net.WebClient
$idUrl = "https://api.twitter.com/1/users/show.json?screen_name=$ScreenName"
$data = $client.DownloadString($idUrl)

$start = 0

$findStr = '"id":'
do {
    $start = $data.IndexOf($findStr, $start + 1)
    if ($start -gt 0) {
        $start += $findStr.Length
        $end = $data.IndexOf(',', $start)
        $userId = $data.SubString($start, $end-$start)
    }
} while ($start -le $data.Length -and $start -gt 0)

$feed = "http://twitter.com/statuses/user_timeline/$userId.rss"

$feed