[vipergirls] extract more metadata & rename fields (#7479)
- forum_title - thread_title - id -> post_id - title -> post_title - number -> post_num
This commit is contained in:
@@ -43,16 +43,18 @@ class VipergirlsExtractor(Extractor):
|
||||
|
||||
def items(self):
|
||||
self.login()
|
||||
posts = self.posts()
|
||||
root = self.posts()
|
||||
forum_title = root[1].attrib["title"]
|
||||
thread_title = root[2].attrib["title"]
|
||||
|
||||
like = self.config("like")
|
||||
if like:
|
||||
user_hash = posts[0].get("hash")
|
||||
user_hash = root[0].get("hash")
|
||||
if len(user_hash) < 16:
|
||||
self.log.warning("Login required to like posts")
|
||||
like = False
|
||||
|
||||
posts = posts.iter("post")
|
||||
posts = root.iter("post")
|
||||
if self.page:
|
||||
util.advance(posts, (text.parse_int(self.page[5:]) - 1) * 15)
|
||||
|
||||
@@ -60,8 +62,14 @@ class VipergirlsExtractor(Extractor):
|
||||
images = list(post)
|
||||
|
||||
data = post.attrib
|
||||
data["forum_title"] = forum_title
|
||||
data["thread_id"] = self.thread_id
|
||||
data["thread_title"] = thread_title
|
||||
data["post_id"] = data.pop("id")
|
||||
data["post_num"] = data.pop("number")
|
||||
data["post_title"] = data.pop("title")
|
||||
data["count"] = len(images)
|
||||
del data["imagecount"]
|
||||
|
||||
yield Message.Directory, data
|
||||
if images:
|
||||
|
||||
@@ -15,8 +15,14 @@ __tests__ = (
|
||||
"#count" : 225,
|
||||
"#sha1_url": "0d75cb42777f5bebc0d284d1d38cb90c750c61d9",
|
||||
|
||||
"count": {112, 113},
|
||||
"num" : range(1, 113),
|
||||
"count" : {112, 113},
|
||||
"num" : range(1, 113),
|
||||
"forum_title" : "Artistic Photo Sets (Archive)",
|
||||
"post_id" : {"116038081", "42953564"},
|
||||
"post_num" : {"1", "2"},
|
||||
"post_title" : str,
|
||||
"thread_id" : "4328304",
|
||||
"thread_title": "FemJoy 2011-05-28 Danica - Simply Beautiful [x112] 4500x3000",
|
||||
},
|
||||
|
||||
{
|
||||
@@ -52,13 +58,13 @@ __tests__ = (
|
||||
"#range" : "2-113",
|
||||
"#count" : 112,
|
||||
|
||||
"count" : 113,
|
||||
"num" : range(2, 113),
|
||||
"id" : "116038081",
|
||||
"imagecount": "113",
|
||||
"number" : "116038081",
|
||||
"thread_id" : "4328304",
|
||||
"title" : "FemJoy Danica - Simply Beautiful (x112) 3000x4500",
|
||||
"count" : 113,
|
||||
"num" : range(2, 113),
|
||||
"post_id" : "116038081",
|
||||
"post_num" : "116038081",
|
||||
"post_title" : "FemJoy Danica - Simply Beautiful (x112) 3000x4500",
|
||||
"thread_id" : "4328304",
|
||||
"thread_title": "FemJoy 2011-05-28 Danica - Simply Beautiful [x112] 4500x3000",
|
||||
},
|
||||
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user