1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[twitter] improve twitpic extraction (fixes #1019)

- ignore twitpic.com/photos/… URLs
- ignore empty image URLs
This commit is contained in:
Mike Fährmann 2020-09-21 22:21:16 +02:00
parent 2184ec5d78
commit aeb0d32333
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,7 @@
# Changelog
## Unreleased
## 1.15.0 - 2020-09-20
### Additions
- [deviantart] support watchers-only/paid deviations ([#995](https://github.com/mikf/gallery-dl/issues/995))

View File

@ -110,16 +110,17 @@ class TwitterExtractor(Extractor):
twitpics = []
for url in tweet["entities"].get("urls", ()):
url = url["expanded_url"]
if "//twitpic.com/" in url:
if "//twitpic.com/" in url and "/photos/" not in url:
response = self.request(url, fatal=False)
if response.status_code >= 400:
continue
url = text.extract(
response.text, 'name="twitter:image" value="', '"')[0]
twitpics.append({
"original_info": {},
"media_url" : url,
})
if url:
twitpics.append({
"original_info": {},
"media_url" : url,
})
if twitpics:
if "extended_entities" in tweet:
tweet["extended_entities"]["media"].extend(twitpics)

View File

@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
__version__ = "1.15.0"
__version__ = "1.15.1-dev"