[twitter] improve syndication video selection (#2354)
- ignore .m3u8 manifests - always select largest format
This commit is contained in:
@@ -1294,7 +1294,10 @@ class TwitterAPI():
|
|||||||
|
|
||||||
if "video" in tweet:
|
if "video" in tweet:
|
||||||
video = tweet["video"]
|
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"]
|
video["variants"][0]["url"] = video["variants"][0]["src"]
|
||||||
tweet["extended_entities"] = {"media": [{
|
tweet["extended_entities"] = {"media": [{
|
||||||
"video_info" : video,
|
"video_info" : video,
|
||||||
|
|||||||
Reference in New Issue
Block a user