chore: add flags spider

This commit is contained in:
2022-06-26 17:18:31 +01:00
parent 7e95992654
commit eda5e67058
4 changed files with 98 additions and 2 deletions

View File

@@ -33,5 +33,19 @@ class AnthemDownloadFilesPipeline(FilesPipeline):
flag_filename = re.search(r"([^\/]*)$", request.url)
if isinstance(flag_filename, re.Match):
if (filename := flag_filename[1]).endswith("ogg") or filename.endswith("oga"):
if (
(filename := flag_filename[1]).endswith("ogg")
or filename.endswith("oga")
or filename.endswith("mp3")
or filename.endswith("wav")
):
return f"files/anthems/{filename}"
class FlagDownloadFilesPipeline(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(".svg"):
return f"files/flags/{filename}"