refactor: rework 2hdp keyword
All checks were successful
dl / lint (push) Successful in 2m43s
dl / docker (push) Successful in 3m58s

This commit is contained in:
Michel Roux 2024-12-25 16:09:36 +01:00
parent a58e7ba4c1
commit f4f1a93611

View File

@ -11,7 +11,10 @@ from requests import get
parser = ArgumentParser()
parser.add_argument(
"--keyword", action="append", default=["mhdgz"], help="Prefered words to search on names"
"--keyword",
action="append",
default=["mhdgz", "winks", "pophd", "multi"],
help="Prefered words to search on names",
)
parser.add_argument(
"--exclude",
@ -103,13 +106,14 @@ for feed in args.feed:
rows = soup.select("table.table tr")
column = None
for keyword in args.keyword:
for row in rows:
columns = row.find_all("td")
if len(columns) == 0:
continue
if any(keyword.lower() in columns[1].text.strip().lower() for keyword in args.keyword):
if keyword.lower() in columns[1].text.strip().lower():
if is_valid(
int(columns[2].a["target"]),
columns[1].text.strip(),
@ -119,21 +123,7 @@ for feed in args.feed:
column = columns
break
if not column:
for row in rows:
columns = row.find_all("td")
if len(columns) == 0:
continue
if "multi" in columns[1].text.strip().lower():
if is_valid(
int(columns[2].a["target"]),
columns[1].text.strip(),
parse_size(columns[5].text.strip()),
int(columns[6].text.strip()),
):
column = columns
if column:
break
writer.writerow(