I'm making a program that scrapes this website. The data is collected, its only the names of items, platform I can use them on, and their price. I've made a data structure for the each scraped bit of information. But I am prompted with a type error when creating my dictionary?
I'm using python 3.7.2. Operating on windows 10.
import requests
import bs4
import time
from bs4 import BeautifulSoup as Bsoup
url = "https://ebgames.com.au/search?q=Skyrim"
resp = requests.get(url)
soup = Bsoup(resp.text, 'html.parser')
platforms = soup.select(".product-top-level-group")
price = soup.select(".price")
names = soup.select(".product-title")
stripped_names = [na.text.strip() for na in names]
stripped_prices = [pri.text.strip() for pri in price]
stripped_platforms = [plat.text.strip() for plat in platforms]
Game = {
(stripped_names): {
"Price": (stripped_prices),
"Platform": [stripped_platforms]
}
}
for Gamename, Gameinfo in Game.items():
print(Gamename)
print("Platform:", Gameinfo['Platform'])
print("Price:", Gameinfo['Price'])
print("\n")
This is my error:
"Platform": [stripped_platforms]
TypeError: unhashable type: 'list'