[pixiv] get rid of an unnecessry api-call

This commit is contained in:
Mike Fährmann
2015-11-22 03:58:31 +01:00
parent 2a97296e69
commit 20a4782173

View File

@@ -111,14 +111,15 @@ class PixivUserExtractor(Extractor):
) )
return url, framelist return url, framelist
def get_job_metadata(self): def get_job_metadata(self, user=None):
"""Collect metadata for extractor-job""" """Collect metadata for extractor-job"""
data = self.api.user(self.artist_id)["response"][0] if not user:
user = self.api.user(self.artist_id)["response"][0]
return { return {
"category": self.category, "category": self.category,
"artist-id": self.artist_id, "artist-id": user["id"],
"artist-name": data["name"], "artist-name": user["name"],
"artist-nick": data["account"], "artist-nick": user["account"],
} }
@@ -143,8 +144,7 @@ class PixivWorkExtractor(PixivUserExtractor):
def get_job_metadata(self): def get_job_metadata(self):
"""Collect metadata for extractor-job""" """Collect metadata for extractor-job"""
self.work = self.api.work(self.illust_id)["response"][0] self.work = self.api.work(self.illust_id)["response"][0]
self.artist_id = self.work["user"]["id"] return PixivUserExtractor.get_job_metadata(self, self.work["user"])
return PixivUserExtractor.get_job_metadata(self)
def require_login(func): def require_login(func):