PoshCode Archive  Artifact [5eab4bfc6e]

Artifact 5eab4bfc6ed30582ed038e857600d915484b04039bbe0e8029466eff8f609a52:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [5a4f9cceb2] at 2018-06-10 13:47:52 on branch trunk — This script will take a Twitter User’s Screen name and get their RSS feed of posts (user: binauralz 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: binauralz
# license: CC0
# x-poshcode-id: 4944
# x-derived-from-id: 4989
# x-archived: 2014-04-13T19:30:00
# x-published: 2014-02-28T15:36: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