1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[twitter] improve syndication video selection (#2354)

- ignore .m3u8 manifests
- always select largest format
This commit is contained in:
Mike Fährmann 2022-04-11 17:06:10 +02:00
parent 0794027100
commit 3e942a58be
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -1294,7 +1294,10 @@ class TwitterAPI():
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,