|
|
@ -29,11 +29,13 @@ class ArtstationExtractor(Extractor):
|
|
|
|
self.user = match.group(1) or match.group(2)
|
|
|
|
self.user = match.group(1) or match.group(2)
|
|
|
|
|
|
|
|
|
|
|
|
def items(self):
|
|
|
|
def items(self):
|
|
|
|
data = self.metadata()
|
|
|
|
videos = self.config("videos", True)
|
|
|
|
|
|
|
|
previews = self.config("previews", False)
|
|
|
|
projects = self.projects()
|
|
|
|
|
|
|
|
external = self.config("external", False)
|
|
|
|
external = self.config("external", False)
|
|
|
|
max_posts = self.config("max-posts")
|
|
|
|
max_posts = self.config("max-posts")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = self.metadata()
|
|
|
|
|
|
|
|
projects = self.projects()
|
|
|
|
if max_posts:
|
|
|
|
if max_posts:
|
|
|
|
projects = itertools.islice(projects, max_posts)
|
|
|
|
projects = itertools.islice(projects, max_posts)
|
|
|
|
|
|
|
|
|
|
|
@ -45,13 +47,29 @@ class ArtstationExtractor(Extractor):
|
|
|
|
asset["num"] = num
|
|
|
|
asset["num"] = num
|
|
|
|
yield Message.Directory, asset
|
|
|
|
yield Message.Directory, asset
|
|
|
|
|
|
|
|
|
|
|
|
if adict["has_embedded_player"] and external:
|
|
|
|
if adict["has_embedded_player"]:
|
|
|
|
player = adict["player_embedded"]
|
|
|
|
player = adict["player_embedded"]
|
|
|
|
url = (text.extr(player, 'src="', '"') or
|
|
|
|
url = (text.extr(player, 'src="', '"') or
|
|
|
|
text.extr(player, "src='", "'"))
|
|
|
|
text.extr(player, "src='", "'"))
|
|
|
|
if url and not url.startswith(self.root):
|
|
|
|
if url.startswith(self.root):
|
|
|
|
asset["extension"] = None
|
|
|
|
# video clip hosted on artstation
|
|
|
|
|
|
|
|
if videos:
|
|
|
|
|
|
|
|
page = self.request(url).text
|
|
|
|
|
|
|
|
url = text.extr(page, ' src="', '"')
|
|
|
|
|
|
|
|
text.nameext_from_url(url, asset)
|
|
|
|
|
|
|
|
yield Message.Url, url, asset
|
|
|
|
|
|
|
|
elif url:
|
|
|
|
|
|
|
|
# external URL
|
|
|
|
|
|
|
|
if external:
|
|
|
|
|
|
|
|
asset["extension"] = "mp4"
|
|
|
|
yield Message.Url, "ytdl:" + url, asset
|
|
|
|
yield Message.Url, "ytdl:" + url, asset
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.log.debug(player)
|
|
|
|
|
|
|
|
self.log.warning(
|
|
|
|
|
|
|
|
"Failed to extract embedded player URL (%s)",
|
|
|
|
|
|
|
|
adict.get("id"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not previews:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
if adict["has_image"]:
|
|
|
|
if adict["has_image"]:
|
|
|
@ -59,6 +77,7 @@ class ArtstationExtractor(Extractor):
|
|
|
|
text.nameext_from_url(url, asset)
|
|
|
|
text.nameext_from_url(url, asset)
|
|
|
|
|
|
|
|
|
|
|
|
url = self._no_cache(url)
|
|
|
|
url = self._no_cache(url)
|
|
|
|
|
|
|
|
if "/video_clips/" not in url:
|
|
|
|
lhs, _, rhs = url.partition("/large/")
|
|
|
|
lhs, _, rhs = url.partition("/large/")
|
|
|
|
if rhs:
|
|
|
|
if rhs:
|
|
|
|
url = lhs + "/4k/" + rhs
|
|
|
|
url = lhs + "/4k/" + rhs
|
|
|
|