Click here to Skip to main content
15,916,189 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am extremely new to python and webscraping, but I am trying to create a code where it pulls the prices of a CSGO Steam skin off of the steam website. It does constantly update, so I'm not sure what the issue is. I keep getting "None" as the output in console. I am using repl.it for my code. This is the code.
import requests
from bs4 import BeautifulSoup

URLChallengerCapsule = 'https://steamcommunity.com/market/listings/730/2020%20RMR%20Challengers'
page = requests.get(URLChallengerCapsule)
soup = BeautifulSoup(page.content, 'html.parser')
results = soup.find(id='market_commodity_buyrequests')

ChallengerCapsulePrice = results.find('span', class_= 'market_commodity_orders_header_promote')

print(ChallengerCapsulePrice)


Specifically, I am looking to solutions to this "none" issue AND any tips on my actual code would be much appreciated. Thanks.

What I have tried:

I've tried many small things like changing the link, trying with and without the "id" line.
Posted
Updated 30-Jan-21 23:14pm

1 solution

It prints "None" because results.find('span', class_= 'market_commodity_orders_header_promote') does not find anything.
 
Share this answer
 
Comments
itsCosine 31-Jan-21 21:25pm    
If you look at the html code in the link, you would've found that the price there does indeed include span, class, and market_commodity_orders_header_promote. So no, it is there.
Richard MacCutchan 1-Feb-21 3:36am    
Well that does not alter the fact that your code is not finding it. You should use the debugger and see exactly what happens at each step.
itsCosine 1-Feb-21 21:24pm    
What is a debugger?
Richard MacCutchan 2-Feb-21 4:12am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900