Add IGNORECASE flag to regex #1
16
main.py
16
main.py
@@ -5,11 +5,12 @@ import aiohttp
|
|||||||
from aiohttp import ClientError
|
from aiohttp import ClientError
|
||||||
|
|
||||||
folder_hyperlink_pat: re.Pattern = re.compile(
|
folder_hyperlink_pat: re.Pattern = re.compile(
|
||||||
r"\<a href=\"\/?([a-zA-Z0-9_ -]+\/)\"\>\s*\<code\>"
|
r"\<a href=\"\/?([a-zA-Z0-9_ -]+\/)\"\>\s*\<code\>", re.IGNORECASE
|
||||||
)
|
)
|
||||||
|
|
||||||
movie_hyperlink_pat: re.Pattern = re.compile(
|
movie_hyperlink_pat: re.Pattern = re.compile(
|
||||||
r"\<a href=\"\/?([a-zA-Z0-9_. -]+\.?(mp4|mkv|avi|mov|wmv|webm))\"\>\s*\<code\>"
|
r"\<a href=\"\/?([a-zA-Z0-9_. -]+\.?(mp4|mkv|avi|mov|wmv|webm))\"\>\s*\<code\>",
|
||||||
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ async def traverse(pool: list[str], url: str, verbose=False) -> None:
|
|||||||
pool.append(join_url(url, file_name))
|
pool.append(join_url(url, file_name))
|
||||||
|
|
||||||
|
|
||||||
URLS: list[str] = ["https://berlin.saymyname.website/Movies/"]
|
URLS: list[str] = ["https://dl1.ehsansub.sbs/"]
|
||||||
|
|
||||||
movies: list[str] = []
|
movies: list[str] = []
|
||||||
|
|
||||||
@@ -74,10 +75,13 @@ async def main():
|
|||||||
f"Is {url[url.find('/') + 2 : url.rfind('.') + url[url.rfind('.') :].find('/')]} fancy?"
|
f"Is {url[url.find('/') + 2 : url.rfind('.') + url[url.rfind('.') :].find('/')]} fancy?"
|
||||||
)
|
)
|
||||||
if not is_fancy:
|
if not is_fancy:
|
||||||
folder_hyperlink_pat = re.compile(r"\<a href=\"\/?([a-zA-Z0-9_ -]+\/)\"\>")
|
folder_hyperlink_pat = re.compile(
|
||||||
|
r"\<a href=\"\/?([a-zA-Z0-9_ -]+\/)\"\>", re.IGNORECASE
|
||||||
|
)
|
||||||
|
|
||||||
movie_hyperlink_pat = re.compile(
|
movie_hyperlink_pat = re.compile(
|
||||||
r"\<a href=\"\/?([a-zA-Z0-9_. -]+\.?(mp4|mkv|avi|mov|wmv|webm))\"\>"
|
r"\<a href=\"\/?([a-zA-Z0-9_. -]+\.?(mp4|mkv|avi|mov|wmv|webm))\"\>",
|
||||||
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
tasks.append(traverse(movies, url, is_verbose))
|
tasks.append(traverse(movies, url, is_verbose))
|
||||||
await asyncio.gather(*tasks)
|
await asyncio.gather(*tasks)
|
||||||
@@ -86,4 +90,4 @@ async def main():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
||||||
open("movies.txt", mode="w", encoding="utf-8").write("\n".join(movies))
|
open("movies.txt", mode="w", encoding="utf-8").write("\n".join(movies))
|
||||||
|
|||||||
Reference in New Issue
Block a user