Skip to content

Commit

Permalink
[twitter] improve syndication video selection (#2354)
Browse files Browse the repository at this point in the history
- ignore .m3u8 manifests
- always select largest format
  • Loading branch information
mikf committed Apr 11, 2022
1 parent 0794027 commit 3e942a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gallery_dl/extractor/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,10 @@ def _syndication_tweet(self, tweet_id):

if "video" in tweet:
video = tweet["video"]
del video["variants"][:-1]
video["variants"] = (max(
(v for v in video["variants"] if v["type"] == "video/mp4"),
key=lambda v: int(v["src"].split("/")[-2].partition("x")[0])
),)
video["variants"][0]["url"] = video["variants"][0]["src"]
tweet["extended_entities"] = {"media": [{
"video_info" : video,
Expand Down

0 comments on commit 3e942a5

Please sign in to comment.