PoshCode Archive  Artifact [8fe41efb69]

Artifact 8fe41efb69d1e0328d9f3e7cc286e5c5f444d4f2ae5d042890fd14ab1ba5095d:

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

# 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: dragonpat
# license: CC0
# x-poshcode-id: 5070
# x-archived: 2014-05-06T07:10:51
# x-published: 2014-04-11T12:59: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