[twitter] fix new-style '/card_img/' URLs
This commit is contained in:
@@ -155,8 +155,11 @@ class TwitterExtractor(Extractor):
|
|||||||
})
|
})
|
||||||
elif "media_url_https" in media:
|
elif "media_url_https" in media:
|
||||||
url = media["media_url_https"]
|
url = media["media_url_https"]
|
||||||
base, _, fmt = url.rpartition(".")
|
if url[-4] == ".":
|
||||||
base += "?format=" + fmt + "&name="
|
base, _, fmt = url.rpartition(".")
|
||||||
|
base += "?format=" + fmt + "&name="
|
||||||
|
else:
|
||||||
|
base = url.rpartition("=")[0] + "="
|
||||||
files.append(text.nameext_from_url(url, {
|
files.append(text.nameext_from_url(url, {
|
||||||
"url" : base + self._size_image,
|
"url" : base + self._size_image,
|
||||||
"width" : width,
|
"width" : width,
|
||||||
@@ -796,6 +799,13 @@ class TwitterTweetExtractor(TwitterExtractor):
|
|||||||
("https://twitter.com/my0nruri/status/1528379296041299968", {
|
("https://twitter.com/my0nruri/status/1528379296041299968", {
|
||||||
"keyword": {"description": "oc"}
|
"keyword": {"description": "oc"}
|
||||||
}),
|
}),
|
||||||
|
# '?format=...&name=...'-style URLs
|
||||||
|
("https://twitter.com/poco_dandy/status/1150646424461176832", {
|
||||||
|
"options": (("cards", True),),
|
||||||
|
"pattern": r"https://pbs.twimg.com/card_img/157\d+/\w+"
|
||||||
|
r"\?format=(jpg|png)&name=orig$",
|
||||||
|
"range": "1-2",
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
|
|||||||
Reference in New Issue
Block a user