[foolfuuka] simplify
- filter posts manually - don't use lists for 'in' checks against constant values
This commit is contained in:
@@ -32,9 +32,10 @@ class FoolfuukaExtractor(BaseExtractor):
|
||||
|
||||
def items(self):
|
||||
yield Message.Directory, "", self.metadata()
|
||||
for post in filter(lambda p: p.get("media"), self.posts()):
|
||||
for post in self.posts():
|
||||
if not (media := post.get("media")):
|
||||
continue
|
||||
board = post["board"]["shortname"]
|
||||
media = post["media"]
|
||||
url = media["media_link"]
|
||||
|
||||
if not url and "remote_media_link" in media:
|
||||
@@ -57,7 +58,7 @@ class FoolfuukaExtractor(BaseExtractor):
|
||||
|
||||
def remote(self, board, media):
|
||||
"""Resolve a remote media link"""
|
||||
if board in ["wsg", "gif"]:
|
||||
if board in {"wsg", "gif"}:
|
||||
return f"https://i.4cdn.org/{board}/{media['media_orig']}"
|
||||
page = self.request(media["remote_media_link"]).text
|
||||
url = text.extr(page, 'http-equiv="Refresh" content="0; url=', '"')
|
||||
|
||||
Reference in New Issue
Block a user