[subscribestar] extract 'title' metadata (#7219)
This commit is contained in:
@@ -39,6 +39,8 @@ class SubscribestarExtractor(Extractor):
|
|||||||
for post_html in self.posts():
|
for post_html in self.posts():
|
||||||
media = self._media_from_post(post_html)
|
media = self._media_from_post(post_html)
|
||||||
data = self._data_from_post(post_html)
|
data = self._data_from_post(post_html)
|
||||||
|
data["title"] = text.unescape(text.extr(
|
||||||
|
data["content"], "<h1>", "</h1>"))
|
||||||
yield Message.Directory, data
|
yield Message.Directory, data
|
||||||
for num, item in enumerate(media, 1):
|
for num, item in enumerate(media, 1):
|
||||||
item.update(data)
|
item.update(data)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ __tests__ = (
|
|||||||
"id" : int,
|
"id" : int,
|
||||||
"num" : int,
|
"num" : int,
|
||||||
"post_id" : int,
|
"post_id" : int,
|
||||||
|
"title" : str,
|
||||||
"type" : r"re:image|video|attachment",
|
"type" : r"re:image|video|attachment",
|
||||||
"url" : str,
|
"url" : str,
|
||||||
"?pinned" : bool,
|
"?pinned" : bool,
|
||||||
@@ -66,6 +67,7 @@ __tests__ = (
|
|||||||
"num" : 1,
|
"num" : 1,
|
||||||
"pinned" : False,
|
"pinned" : False,
|
||||||
"post_id" : 102468,
|
"post_id" : 102468,
|
||||||
|
"title" : "Brand Guidelines and Assets",
|
||||||
"type" : "image",
|
"type" : "image",
|
||||||
"width" : 700,
|
"width" : 700,
|
||||||
},
|
},
|
||||||
@@ -85,6 +87,7 @@ __tests__ = (
|
|||||||
"name" : "Training for freelancers - Fiverr.pdf",
|
"name" : "Training for freelancers - Fiverr.pdf",
|
||||||
"num" : 2,
|
"num" : 2,
|
||||||
"post_id" : 920015,
|
"post_id" : 920015,
|
||||||
|
"title" : "",
|
||||||
"type" : "attachment",
|
"type" : "attachment",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user