kaihendry / greptweet

Sane twitter backup and search
https://greptweet.com/
Other
76 stars 10 forks source link

Retweet URLs don't get expanded #14

Closed JamieKitson closed 11 years ago

JamieKitson commented 12 years ago

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

JamieKitson commented 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

JamieKitson commented 11 years ago

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?

JamieKitson commented 11 years ago

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.

JamieKitson commented 11 years ago

Ok, 1) should be fixed by 12338f6.

JamieKitson commented 11 years ago

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"
kaihendry commented 11 years ago

Fixed in d78209c75d120c97d7e5a0d39f883bc367d2893e