[pawoo] restore metadata fields + smaller improvements
This commit is contained in:
@@ -40,13 +40,6 @@ class PawooExtractor(Extractor):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare(status):
|
def prepare(status):
|
||||||
"""Prepare a status object"""
|
"""Prepare a status object"""
|
||||||
for key in ("favourites_count", "reblogs_count", "reblog", "mentions",
|
|
||||||
"favourited", "muted", "reblogged"):
|
|
||||||
del status[key]
|
|
||||||
account = status["account"]
|
|
||||||
for key in ("followers_count", "following_count", "statuses_count",
|
|
||||||
"oauth_authentications"):
|
|
||||||
del account[key]
|
|
||||||
attachments = status["media_attachments"]
|
attachments = status["media_attachments"]
|
||||||
del status["media_attachments"]
|
del status["media_attachments"]
|
||||||
return attachments
|
return attachments
|
||||||
@@ -55,11 +48,10 @@ class PawooExtractor(Extractor):
|
|||||||
class PawooUserExtractor(PawooExtractor):
|
class PawooUserExtractor(PawooExtractor):
|
||||||
"""Extractor for all images of an account/user on pawoo.net"""
|
"""Extractor for all images of an account/user on pawoo.net"""
|
||||||
subcategory = "user"
|
subcategory = "user"
|
||||||
pattern = [r"(?:https?://)?pawoo\.net/(@[^/]+)(?:/media)?/?$"]
|
pattern = [r"(?:https?://)?pawoo\.net/@([^/?&#]+)(?:/media)?/?$"]
|
||||||
test = [
|
test = [
|
||||||
("https://pawoo.net/@kuroda", {
|
("https://pawoo.net/@kuroda", {
|
||||||
"url": "a3f9e7555f2b024554c0e9b6cbcc7991af13cf99",
|
"url": "a3f9e7555f2b024554c0e9b6cbcc7991af13cf99",
|
||||||
"keyword": "e300caf8286fbebd00215b7c89b25617b6ef0b88",
|
|
||||||
}),
|
}),
|
||||||
("https://pawoo.net/@zZzZz/", {
|
("https://pawoo.net/@zZzZz/", {
|
||||||
"exception": exception.NotFoundError,
|
"exception": exception.NotFoundError,
|
||||||
@@ -72,9 +64,9 @@ class PawooUserExtractor(PawooExtractor):
|
|||||||
self.account_name = match.group(1)
|
self.account_name = match.group(1)
|
||||||
|
|
||||||
def statuses(self):
|
def statuses(self):
|
||||||
results = self.api.account_search(self.account_name, 1)
|
results = self.api.account_search("@" + self.account_name, 1)
|
||||||
for account in results:
|
for account in results:
|
||||||
if account["username"] == self.account_name[1:]:
|
if account["username"] == self.account_name:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise exception.NotFoundError("account")
|
raise exception.NotFoundError("account")
|
||||||
@@ -84,11 +76,10 @@ class PawooUserExtractor(PawooExtractor):
|
|||||||
class PawooStatusExtractor(PawooExtractor):
|
class PawooStatusExtractor(PawooExtractor):
|
||||||
"""Extractor for images from a status on pawoo.net"""
|
"""Extractor for images from a status on pawoo.net"""
|
||||||
subcategory = "status"
|
subcategory = "status"
|
||||||
pattern = [r"(?:https?://)?pawoo\.net/@[^/]+/(\d+)"]
|
pattern = [r"(?:https?://)?pawoo\.net/@[^/?&#]+/(\d+)"]
|
||||||
test = [
|
test = [
|
||||||
("https://pawoo.net/@takehana_note/559043", {
|
("https://pawoo.net/@takehana_note/559043", {
|
||||||
"url": "f95cc8c0274c4143e7e21dbdc693b90c65b596e3",
|
"url": "f95cc8c0274c4143e7e21dbdc693b90c65b596e3",
|
||||||
"keyword": "1495670fd098e6cc456c95897ae6af36534c2bad",
|
|
||||||
"content": "3b148cf90174173355fe34179741ce476921b2fc",
|
"content": "3b148cf90174173355fe34179741ce476921b2fc",
|
||||||
}),
|
}),
|
||||||
("https://pawoo.net/@zZzZz/12346", {
|
("https://pawoo.net/@zZzZz/12346", {
|
||||||
|
|||||||
Reference in New Issue
Block a user