fork download
  1. import requests
  2. import time
  3. import csv
  4.  
  5. for i in range(71):
  6.  
  7. session = requests.session()
  8. r = session.get('https://w...content-available-to-author-only...g.com/games/ajax/filtered?hide=dlc&mediaType=game&page='
  9. + str(i) + '&sort=release_asc', headers={'User-Agent': 'Mozzila'})
  10. # https://w...content-available-to-author-only...g.com/games/ajax/filtered?mediaType=game&page=1&sort=date
  11.  
  12. main_url = 'gog.com'
  13.  
  14. if r.status_code == 200:
  15. for index in range(47):
  16. title = r.json()['products'][index]['title']
  17. publisher = r.json()['products'][index]['publisher']
  18. developer = r.json()['products'][index]['developer']
  19. genres = r.json()['products'][index]['genres']
  20. category = r.json()['products'][index]['category']
  21. release_date = time.ctime(r.json()['products'][index]['releaseDate'])
  22. url_to_the_game = main_url + r.json()['products'][index]['url']
  23. supportedOS = r.json()['products'][index]['supportedOperatingSystems']
  24. # image_gallery = r.json()['products'][index]['gallery']
  25. # video_gallery = r.json()['products'][index]['video']
  26. game = [title, publisher, developer, genres, category, release_date,
  27. url_to_the_game, supportedOS]
  28. # game = [title, supportedOS]
  29. print(game)
  30. with open('GOG games parsed.csv', 'a', newline='', encoding='utf8') as csvfile:
  31. writer = csv.writer(csvfile)
  32. writer.writerow(game)
  33. # your code goes here
Runtime error #stdin #stdout #stderr 0.02s 7292KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 1, in <module>
ImportError: No module named requests