PoshCode Archive  Artifact [cf4165704d]

Artifact cf4165704d2f249c9d6b3da5d7e50860cab1ef572b136e596aceefe04d831447:

  • File Get-Twitter-RSS-Feed.ps1 — part of check-in [679efccf8a] at 2018-06-10 14:20:30 on branch trunk — ewew (user: sammilkey size: 823)

# encoding: ascii
# api: powershell
# title: Get Twitter RSS Feed
# description: ewew
# version: 0.1
# author: sammilkey
# license: CC0
# x-poshcode-id: 6755
# x-archived: 2017-02-27T22:13:20
# x-published: 2017-02-26T16:35: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