PoshCode Archive  Artifact [6bc9efe615]

Artifact 6bc9efe615255aa7353b3628988e8648929d9414471af744879104506c173517:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [06a097b47f] at 2018-06-10 13:48:34 on branch trunk — This script will take a Twitter User’s Screen name and get their RSS feed of posts (user: echosmith size: 930)

# encoding: ascii
# api: powershell
# title: Get Twitter RSS Feed
# description: This script will take a Twitter User’s Screen name and get their RSS feed of posts
# version: 0.1
# author: echosmith
# license: CC0
# x-poshcode-id: 4995
# x-derived-from-id: 5069
# x-archived: 2014-04-20T07:34:06
# x-published: 2014-03-18T18:01: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