Using PowerShell to Archive Twitter Feeds–Preserving the wisdom of Paul Randal

You may also like...

2 Responses

  1. Chad Miller says:

    Take a look at export-csv. You can then use Invoke-sqlcmd or just plain old sqlcmd/osql to run a BULK INSERT statement to import the csv:
    ([xml] (new-object net.webclient).DownloadString(“http://twitter.com/favorites/76699854.rss”)).rss.channel.item | Select description, pubDate, link | Export-Csv -NoTypeInformation ./randal.csv

    Another option is to build up a batch of insert statements and then call invoke-sqlcmd/sqlcmd:

    $sql = ([xml] (new-object net.webclient).DownloadString(“http://twitter.com/favorites/76699854.rss”)).rss.channel.item | foreach { “INSERT twitter_feeds VALUES (‘$($_.description)’,’$($_.pubDate)’, ‘$($_.link)’)”}

    There’s a few other options listed here:
    http://www.sqlservercentral.com/articles/powershell/65196/

  2. Max Trinidad says:

    To eliminate the truncate description you need to remove the “FT” line and save the result to a variable, then use Get-member to see all the Properties available to you. Then, with some more PowerShell code you could move the data around and put it somewhere else…maybe a SQL table.
    🙂

    One thing for sure… once you start using PowerShell, there’s no stop!

Leave a Reply

%d bloggers like this: