[deviantart] extend 'extra' option
also download from embedded DeviantArt posts
This commit is contained in:
@@ -729,7 +729,7 @@ Type
|
|||||||
Default
|
Default
|
||||||
``false``
|
``false``
|
||||||
Description
|
Description
|
||||||
Download extra Sta.sh resources from
|
Download embedded Deviations and Sta.sh resources from
|
||||||
description texts and journals.
|
description texts and journals.
|
||||||
|
|
||||||
Note: Enabling this option also enables deviantart.metadata_.
|
Note: Enabling this option also enables deviantart.metadata_.
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ class DeviantartExtractor(Extractor):
|
|||||||
else:
|
else:
|
||||||
self.user = profile["user"]["username"]
|
self.user = profile["user"]["username"]
|
||||||
|
|
||||||
|
if self.extra:
|
||||||
|
finditer_stash = DeviantartStashExtractor.pattern.finditer
|
||||||
|
finditer_deviation = DeviantartDeviationExtractor.pattern.finditer
|
||||||
|
|
||||||
yield Message.Version, 1
|
yield Message.Version, 1
|
||||||
for deviation in self.deviations():
|
for deviation in self.deviations():
|
||||||
if isinstance(deviation, tuple):
|
if isinstance(deviation, tuple):
|
||||||
@@ -134,10 +138,14 @@ class DeviantartExtractor(Extractor):
|
|||||||
if self.extra:
|
if self.extra:
|
||||||
txt = (deviation.get("description", "") +
|
txt = (deviation.get("description", "") +
|
||||||
deviation.get("_journal", ""))
|
deviation.get("_journal", ""))
|
||||||
for match in DeviantartStashExtractor.pattern.finditer(txt):
|
for match in finditer_stash(txt):
|
||||||
url = text.ensure_http_scheme(match.group(0))
|
url = text.ensure_http_scheme(match.group(0))
|
||||||
deviation["_extractor"] = DeviantartStashExtractor
|
deviation["_extractor"] = DeviantartStashExtractor
|
||||||
yield Message.Queue, url, deviation
|
yield Message.Queue, url, deviation
|
||||||
|
for match in finditer_deviation(txt):
|
||||||
|
url = text.ensure_http_scheme(match.group(0))
|
||||||
|
deviation["_extractor"] = DeviantartDeviationExtractor
|
||||||
|
yield Message.Queue, url, deviation
|
||||||
|
|
||||||
def deviations(self):
|
def deviations(self):
|
||||||
"""Return an iterable containing all relevant Deviation-objects"""
|
"""Return an iterable containing all relevant Deviation-objects"""
|
||||||
|
|||||||
Reference in New Issue
Block a user