-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
29 lines (22 loc) · 944 Bytes
/
main.py
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
#!/usr/bin/env python3.7
import requests
from bs4 import BeautifulSoup
language = ["en", "de","es","fr","it","pt","ru","ko","cn"]
item_id_start = 1
item_id_end = 100
for i in range (item_id_start,item_id_end+1):
# first, check if item exists
test_url="https://en.classic.wowhead.com/item="+str(i)
test_page = requests.get(test_url)
test_soup = BeautifulSoup(test_page.content, 'html.parser')
if test_soup.find("h1", {"class": "heading-size-1"}).text != "Items":
print("URL: https://en.classic.wowhead.com/item="+str(i))
#second, pull translations
for l in language:
url = "https://"+l+".classic.wowhead.com/item="+str(i)
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
# get item name
print(l + ": " + soup.find("h1", {"class": "heading-size-1"}).text)
print("=========")
print("DONE")