[twitter] improve twitpic extraction (fixes #1019)
- ignore twitpic.com/photos/… URLs - ignore empty image URLs
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
## 1.15.0 - 2020-09-20
|
## 1.15.0 - 2020-09-20
|
||||||
### Additions
|
### Additions
|
||||||
- [deviantart] support watchers-only/paid deviations ([#995](https://github.com/mikf/gallery-dl/issues/995))
|
- [deviantart] support watchers-only/paid deviations ([#995](https://github.com/mikf/gallery-dl/issues/995))
|
||||||
|
|||||||
@@ -110,16 +110,17 @@ class TwitterExtractor(Extractor):
|
|||||||
twitpics = []
|
twitpics = []
|
||||||
for url in tweet["entities"].get("urls", ()):
|
for url in tweet["entities"].get("urls", ()):
|
||||||
url = url["expanded_url"]
|
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)
|
response = self.request(url, fatal=False)
|
||||||
if response.status_code >= 400:
|
if response.status_code >= 400:
|
||||||
continue
|
continue
|
||||||
url = text.extract(
|
url = text.extract(
|
||||||
response.text, 'name="twitter:image" value="', '"')[0]
|
response.text, 'name="twitter:image" value="', '"')[0]
|
||||||
twitpics.append({
|
if url:
|
||||||
"original_info": {},
|
twitpics.append({
|
||||||
"media_url" : url,
|
"original_info": {},
|
||||||
})
|
"media_url" : url,
|
||||||
|
})
|
||||||
if twitpics:
|
if twitpics:
|
||||||
if "extended_entities" in tweet:
|
if "extended_entities" in tweet:
|
||||||
tweet["extended_entities"]["media"].extend(twitpics)
|
tweet["extended_entities"]["media"].extend(twitpics)
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.15.0"
|
__version__ = "1.15.1-dev"
|
||||||
|
|||||||
Reference in New Issue
Block a user