Closed JamieKitson closed 11 years ago
xmlstarlet sel -t -m "statuses/status" -m ".|retweeted_status" -i "(name() = 'status' and not(retweeted_status)) or name() = 'retweeted_status'" -n -o "text " -v "id" -o "|" -v "created_at" -o "|" -i "name() = 'retweeted_status'" -o "RT @" -v "user/screen_name" -o ": " -b -v "normalize-space(text)" -m "entities/urls/url" -i "expanded_url != ''" -n -o "url " -v "url" -o " " -v "expanded_url"
Not pretty, but it works. This will also fix #17
Actually I think there's a couple of problems with this. 1) it will return the id and date of the original tweet, 2) what happens if someone edits the tweet?
Actually if you edit a retweet does it still come out as a retweet? I notice you can't edit a tweet before retweeting it on the web interface.
Ok, 1) should be fixed by 12338f6.
For some reason the retweet user is not being pulled out, I can't work out why, on the command line it works fine. See #L96:
-v "user/screen_name"
Fixed in d78209c75d120c97d7e5a0d39f883bc367d2893e
In retweets the URL is embedded further into the URL, instread of:
statuses/status/entities/urls/url
They're in:
statuses/status/retweeted_status/entities/urls/url
See for example:
http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=jamiekitson&count=1&include_rts=1&include_entities=1&max_id=206041113159667712