chiark / gitweb /
Parse video objects less stoatily
The https://github.com/bear/python-twitter API throws away the
extended-information field in which the name of the video file is stored;
so parse the JSON again ourselves to get hold of it.
Pick the highest bit rate MP4 video.
Throw away the old ad-hoc mangling of video_thumb urls; that is no
longer needed.
Signed-off-by: Tom Womack <tom@womack.net>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
v2:
Fix logic error:
When tweet contains multiple media, handle videos as videos and
non-videos as non-videos. Resulting patch has rather different
organisation and does less violence to the original code.
Commit message changes:
Mention deletion of tweet_video_thumb hack
Style fixes and changes:
Do not add a comment about the new import
Use .get(DEFVAL) rather than nesting in if KEY in VAL, throughout
Reformat new comment about JSON parsing to 80 columns
Use ' rather than " for protocol elements such as hash keys
Use split rather than a regexp to trim ? part from url
Comments say "we" do something, not "I".
When searching for the best, have a single `best' variable
Divide float by float not int
Adjust new replacement string construction to be more natural
Be consistent about spaces around ==