PoshCode Archive  Artifact [c14c1c1578]

Artifact c14c1c1578f0f86b922b6160dc1a63bf381849cb8f70b49986db719168c29d4d:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [8aa599e229] at 2018-06-10 13:47:28 on branch trunk — This doesn’t work any longer – Twitter has retired the v1 API. (user: ReviewNursing size: 938)

# encoding: ascii
# api: powershell
# title: Get Twitter RSS Feed
# description: This doesn’t work any longer – Twitter has retired the v1 API.
# version: 0.1
# author: ReviewNursing
# license: CC0
# x-poshcode-id: 4881
# x-archived: 2014-02-07T23:47:51
# x-published: 2014-02-04T18:25:00
#
# https://dev.twitter.com/docs/api/1.1/overview
#
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