1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| from urllib.request import urlopen from bs4 import BeautifulSoup import ssl
ssl._create_default_https_context = ssl._create_unverified_context url = urlopen('https://steamcommunity.com/app/563560/workshop/')
bs = BeautifulSoup(url, 'html.parser') hyperlink = bs.find_all('a') file = open('./url.txt', 'w')
for h in hyperlink: hh = h.get('href') if hh and '/sharedfiles/filedetails/' in hh and '#comments' not in hh: print(hh) file.write(hh) file.write('\n')
file.close()
|