PoshCode Archive  Artifact [cd741339a1]

Artifact cd741339a1944a21cc877a988a4576264f7fd940e89e71d19ce6af9c6d707d81:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [ce5dad726a] at 2018-06-10 14:20:43 on branch trunk — This script will take a Twitter User’s Screen name and get their RSS feed of posts (user: ZioNLight1 size: 904)

# 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: ZioNLight1
# license: CC0
# x-poshcode-id: 6770
# x-archived: 2017-03-12T06:20:30
# x-published: 2017-03-04T23:24: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