Webscraping Data From An Interactive Graph From A Website
I am trying to access data from the graph from the below mentioned website https://www.prisjakt.nu/produkt.php?pu=5183925 I am able to access and extract data from the table below
Solution 1:
You're right, the graph is being constructed dynamically, but you can easily grab that data.
Here's how:
import requests
response = requests.get('https://www.prisjakt.nu/_internal/graphql?release=2020-11-20T07:33:45Z|db08e4bc&version=6f2bf5&main=product&variables={"id":5183925,"offset":0,"section":"statistics","statisticsTime":"1970-01-02","marketCode":"se","personalizationExcludeCategories":[],"userActions":true,"badges":true,"media":true,"campaign":true,"relatedProducts":true,"campaignDeals":true,"priceHistory":true,"recommendations":true,"campaignId":2,"personalizationClientId":"","pulseEnvironmentId":"sdrn:schibsted:environment:undefined"}').json()
for node in response["data"]["product"]["statistics"]["nodes"]:
print(f"{node['date']} - {node['lowestPrice']}")
Output:
2019-09-10-131952019-09-11-129902019-09-12-129902019-09-13-126052019-09-14-126052019-09-15-126052019-09-16-129702019-09-17-129702019-09-18-129702019-09-19-129692019-09-20-129692019-09-21-129692019-09-22-129692019-09-23-91952019-09-24-12970andsoon...
Post a Comment for "Webscraping Data From An Interactive Graph From A Website"