refactor: ⚡ rework 2hdp keyword
This commit is contained in:
parent
a58e7ba4c1
commit
f4f1a93611
@ -11,7 +11,10 @@ from requests import get
|
|||||||
|
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument(
|
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(
|
parser.add_argument(
|
||||||
"--exclude",
|
"--exclude",
|
||||||
@ -103,13 +106,14 @@ for feed in args.feed:
|
|||||||
rows = soup.select("table.table tr")
|
rows = soup.select("table.table tr")
|
||||||
column = None
|
column = None
|
||||||
|
|
||||||
|
for keyword in args.keyword:
|
||||||
for row in rows:
|
for row in rows:
|
||||||
columns = row.find_all("td")
|
columns = row.find_all("td")
|
||||||
|
|
||||||
if len(columns) == 0:
|
if len(columns) == 0:
|
||||||
continue
|
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(
|
if is_valid(
|
||||||
int(columns[2].a["target"]),
|
int(columns[2].a["target"]),
|
||||||
columns[1].text.strip(),
|
columns[1].text.strip(),
|
||||||
@ -119,21 +123,7 @@ for feed in args.feed:
|
|||||||
column = columns
|
column = columns
|
||||||
break
|
break
|
||||||
|
|
||||||
if not column:
|
if 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
|
|
||||||
break
|
break
|
||||||
|
|
||||||
writer.writerow(
|
writer.writerow(
|
||||||
|
Loading…
Reference in New Issue
Block a user