PoshCode Logo PowerShell Code Repository

Get Twitter RSS Feed by ZioNLight1 7 weeks ago (modification of post by ZioNLight1 view diff)
diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/6770"></script>download | new post

This script will take a Twitter User’s Screen name and get their RSS feed of posts

  1. param ([String] $ScreenName)
  2.  
  3. $client = New-Object System.Net.WebClient
  4. $idUrl = "https://api.twitter.com/1/users/show.json?screen_name=$ScreenName"
  5. $data = $client.DownloadString($idUrl)
  6.  
  7. $start = 0
  8.  
  9. $findStr = '"id":'
  10. do {
  11.     $start = $data.IndexOf($findStr, $start + 1)
  12.     if ($start -gt 0) {
  13.         $start += $findStr.Length
  14.         $end = $data.IndexOf(',', $start)
  15.         $userId = $data.SubString($start, $end-$start)
  16.     }
  17. } while ($start -le $data.Length -and $start -gt 0)
  18.  
  19. $feed = "http://twitter.com/statuses/user_timeline/$userId.rss"
  20.  
  21. $feed

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me