[weibo] handle 'gif' pictures
This commit is contained in:
parent
345199a3ec
commit
73f673e3ca
@ -81,14 +81,22 @@ class WeiboExtractor(Extractor):
|
|||||||
pics = status["pic_infos"]
|
pics = status["pic_infos"]
|
||||||
for pic_id in pic_ids:
|
for pic_id in pic_ids:
|
||||||
pic = pics[pic_id]
|
pic = pics[pic_id]
|
||||||
|
pic_type = pic.get("type")
|
||||||
|
|
||||||
|
if pic_type == "gif" and self.videos:
|
||||||
|
yield {"url": pic["video"]}
|
||||||
|
|
||||||
|
elif pic_type == "livephoto" and self.livephoto:
|
||||||
yield pic["largest"].copy()
|
yield pic["largest"].copy()
|
||||||
|
|
||||||
if pic.get("type") == "livephoto" and self.livephoto:
|
|
||||||
file = {"url": pic["video"]}
|
file = {"url": pic["video"]}
|
||||||
file["filehame"], _, file["extension"] = \
|
file["filehame"], _, file["extension"] = \
|
||||||
pic["video"].rpartition("%2F")[2].rpartition(".")
|
pic["video"].rpartition("%2F")[2].rpartition(".")
|
||||||
yield file
|
yield file
|
||||||
|
|
||||||
|
else:
|
||||||
|
yield pic["largest"].copy()
|
||||||
|
|
||||||
if "page_info" in status:
|
if "page_info" in status:
|
||||||
page_info = status["page_info"]
|
page_info = status["page_info"]
|
||||||
if "media_info" not in page_info or not self.videos:
|
if "media_info" not in page_info or not self.videos:
|
||||||
@ -318,12 +326,17 @@ class WeiboStatusExtractor(WeiboExtractor):
|
|||||||
"options": (("retweets", "original"),),
|
"options": (("retweets", "original"),),
|
||||||
"keyword": {"status": {"id": 4600167083287033}},
|
"keyword": {"status": {"id": 4600167083287033}},
|
||||||
}),
|
}),
|
||||||
# livephoto (#2146)
|
# type == livephoto (#2146)
|
||||||
("https://weibo.com/5643044717/KkuDZ4jAA", {
|
("https://weibo.com/5643044717/KkuDZ4jAA", {
|
||||||
"range": "2,4,6",
|
"range": "2,4,6",
|
||||||
"pattern": r"https://video\.weibo\.com/media/play\?livephoto="
|
"pattern": r"https://video\.weibo\.com/media/play\?livephoto="
|
||||||
r"https%3A%2F%2Fus.sinaimg.cn%2F\w+\.mov",
|
r"https%3A%2F%2Fus.sinaimg.cn%2F\w+\.mov",
|
||||||
}),
|
}),
|
||||||
|
# type == gif
|
||||||
|
("https://weibo.com/1758989602/LvBhm5DiP", {
|
||||||
|
"pattern": r"http://g\.us\.sinaimg.cn/o0/qNZcaAAglx07Wuf921CM01041"
|
||||||
|
r"20005tc0E010\.mp4\?label=gif_mp4",
|
||||||
|
}),
|
||||||
("https://m.weibo.cn/status/4339748116375525"),
|
("https://m.weibo.cn/status/4339748116375525"),
|
||||||
("https://m.weibo.cn/5746766133/4339748116375525"),
|
("https://m.weibo.cn/5746766133/4339748116375525"),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user