So I am trying to scrape games off my steam wish-list using beautifulsoup. Ideally, I would like the name of the game, the link to the steam store page of the game and the currently listed price. The issue is that when I call soup.find_all("div", {"class": "wishlist_row"})
it returns an empty list despite me being able to see that there should be several of these divs for each game on my wish-list in the inspector. Here is a condensed version of my current code:
from bs4 import BeautifulSoup
import requests
profile_id = "id/Zorro4"
url_base = "https://store.steampowered.com/wishlist/"
r = requests.get(url_base + profile_id + "#sort=order", headers=header)
data = r.text
soup = BeautifulSoup(data, features="lxml")
# find divs containing information about game and steam price
divs = soup.findAll("div", {"class": "wishlist_row"})
print(divs)
>>> []
I can clearly see these divs in the inspector if I go to https://store.steampowered.com/wishlist/id/zorro4/#sort=order I have tried
- Using html.parser instead of lxml
- Spoofing the user-agent / header
- Tried using
.find("div", {"class": "wishlist_row"})
instead - Looked, among others, through these threads
I have noticed something odd that might help solve the problem but I am not sure what to make of it.
soup.find(id="wishlist_ctn") # The div which should contain all the wishlist_row divs
>>> <div id="wishlist_ctn">\n</div>
This, as far as I know, should return <div id="wishlist_ctn">...</div>
since the div contains more nested divs (the ones I'm looking for). I am not sure why it just returns a newline character. It's almost as though when scraping the contents of the wishlist_ctn div gets lost. Any help would be super appreciated, I've been trying to solve this for the last couple days with no success.