score:0

Accepted answer

one option is to use the api that provides the data for the highcharts.

note: there are different sources data-without-keyshops-url and data-with-keyshops-url

step#1 - generate the dataurl from the product page

soup = bs(requests.get('https://gg.deals/game/snowrunner/').text, 'lxml')

dataurl = 'https://gg.deals'+soup.select_one('#historical-chart-container')['data-without-keyshops-url']

step#2 - request the json data

r  = requests.get(dataurl, headers={'x-requested-with': 'xmlhttprequest'})
r.json()

example

import requests,json
from bs4 import beautifulsoup as bs

url = 'https://gg.deals/game/snowrunner/'
r = requests.get(url)
soup = bs(r.text, 'lxml')

dataurl = 'https://gg.deals'+soup.select_one('#historical-chart-container')['data-without-keyshops-url']
r  = requests.get(dataurl, headers={'x-requested-with': 'xmlhttprequest'})
r.json()['chartdata']['deals']

output

[{'x': 1581956320000,
  'y': 39.99,
  'shop': 'epic games store',
  'name': '17 feb 2020 16:18 - 22 may 2020 15:38'},
 {'x': 1590161908000,
  'y': 29.99,
  'shop': 'epic games store',
  'name': '22 may 2020 15:38 - 11 jun 2020 17:11'},
 {'x': 1591895501000,
  'y': 39.99,
  'shop': 'epic games store',
  'name': '11 jun 2020 17:11 - 16 jun 2020 13:18'},
 {'x': 1592313517000,
  'y': 31.99,
  'shop': 'epic games store',
  'name': '16 jun 2020 13:18 - 30 jun 2020 13:20'},
 {'x': 1593523255000,
  'y': 39.99,
  'shop': 'epic games store',
  'name': '30 jun 2020 13:20 - 23 jul 2020 16:08'},
 {'x': 1595520520000,
  'y': 31.99,
  'shop': 'epic games store',
  'name': '23 jul 2020 16:08 - 6 aug 2020 15:03'},
 {'x': 1596726196000,
  'y': 39.99,
  'shop': 'epic games store',
  'name': '6 aug 2020 15:03 - 24 sep 2020 16:19'},...]

Related Query

More Query from same tag