PoshCode Archive  Artifact [d7483845ba]

Artifact d7483845ba2bba094cb4cd8d2dc7256fb9e2d9c4aa0905dcd67e8723d9a009e9:

  • File Amma-Chimes.ps1 — part of check-in [57804731f0] at 2018-06-10 14:19:49 on branch trunk — This script will take a Twitter User’s Screen name and get their RSS feed of posts (user: Booksurfers_ size: 897)

# encoding: ascii
# api: powershell
# title: Amma Chimes
# description: This script will take a Twitter User’s Screen name and get their RSS feed of posts
# version: 0.1
# author: Booksurfers_
# license: CC0
# x-poshcode-id: 6712
# x-archived: 2017-02-02T03:22:17
# x-published: 2017-01-29T13:32: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