-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf.py
More file actions
33 lines (23 loc) · 1.03 KB
/
f.py
File metadata and controls
33 lines (23 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
from bs4 import BeautifulSoup
search_term = input("Enter a Hololive member name or generation to search for: ")
url = f"https://hololive.hololivepro.com/en/talents?gp=hololive"
page = requests.get(url).text
doc = BeautifulSoup(page, "html.parser")
talent_list = doc.find_all("div", {"class": "talent"})
talents_found = {}
for talent in talent_list:
name_elem = talent.find("div", {"class": "talent-name"})
name = name_elem.text.strip()
gen_elem = talent.find("div", {"class": "talent-generation"})
gen = gen_elem.text.strip()
link_elem = talent.find("a", {"class": "talent-link"})
link = link_elem.get("href")
if search_term.lower() in name.lower() or search_term.lower() in gen.lower():
talents_found[name] = {"generation": gen, "link": link}
sorted_talents = sorted(talents_found.items(), key=lambda x: x[1]['generation'])
for talent in sorted_talents:
print(talent[0])
print(talent[1]['generation'])
print(talent[1]['link'])
print("-------------------------------")