PoshCode Archive  Artifact [e0adba50c1]

Artifact e0adba50c13232364a4e60094e73c0c5a68341130108382dee0c4e6a55b3cab2:

  • File This-script-will-take-a-.ps1 — part of check-in [16e63c5b9e] at 2018-06-10 13:47:47 on branch trunk — This script will take a Twitter User’s Screen name and get their RSS feed of posts (user: unknown size: 826)

# encoding: ascii
# api: powershell
# title: 
# description: This script will take a Twitter User’s Screen name and get their RSS feed of posts
# version: 0.1
# license: CC0
# x-poshcode-id: 4923
# x-archived: 2014-05-06T23:20:41
#
#
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