25 lines
797 B
Python
Executable File
25 lines
797 B
Python
Executable File
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import requests # http requests
|
|
import bs4 # html parser
|
|
|
|
with open("titles.txt", "w", encoding="UTF-8") as file:
|
|
for index in range(1, 175):
|
|
url = "https://www.gogdb.org/products?page=" + str(index)
|
|
print(url)
|
|
|
|
page = requests.get("https://www.gogdb.org/products?page=" + str(index))
|
|
page.raise_for_status()
|
|
|
|
soup = bs4.BeautifulSoup(page.text, "html.parser")
|
|
|
|
producttable = soup.select("#product-table")[0]
|
|
titles = producttable.select("tr")
|
|
for title in titles:
|
|
if len(title.select(".col-type")) == 0:
|
|
continue
|
|
|
|
if title.select(".col-type")[0].text == 'Game':
|
|
file.write(title.select(".col-name")[0].text.strip() + '\n')
|