chore: add anthems spider

This commit is contained in:
2022-06-25 17:01:53 +01:00
parent e865018fd9
commit 1156976823
8 changed files with 260 additions and 146 deletions

View File

@@ -26,3 +26,12 @@ class WikipediaCountryScraperFilesPipeline(FilesPipeline):
return f"files/flags/{filename}"
elif filename.endswith(".ogg") or filename.endswith("oga"):
return f"files/anthems/{filename}"
class AnthemDownloadFilesPipeline(FilesPipeline):
def file_path(self, request, response=None, info=None, *, item=None):
flag_filename = re.search(r"([^\/]*)$", request.url)
if isinstance(flag_filename, re.Match):
if (filename := flag_filename[1]).endswith("ogg") or filename.endswith("oga"):
return f"files/anthems/{filename}"