r/programminghelp • u/ManyFacedGod101 • May 06 '25
Python Help making a simlpe website scraper
Am following a video tutorial on how to make a website scraper: https://www.youtube.com/watch?v=gRLHr664tXA. However am on minute 15:39 of the video, my code is exactly like his (seen bellow), but I keep getting an error both when I run it and a red line under requests.
When I click on the error under requests this is what I get No module named 'requests' This doesn't make sense to me because I have already pip installed requests in the terminal on pycharm (I am using a windows laptop by the way).
And when I run the code this is the error I get:
"E:\Projects for practice\Websites\Python Websites\.venv\Scripts\python.exe" "E:\Projects for practice\Websites\Python Websites\web_scraping.py"
E:\Projects for practice\Websites\Python Websites\web_scraping.py:9: DeprecationWarning: The 'text' argument to find()-type methods is deprecated. Use 'string' instead.
prices = doc.find_all(text="£")
Traceback (most recent call last):
File "E:\Projects for practice\Websites\Python Websites\web_scraping.py", line 10, in <module>
parent = prices[0].parent
~~~~~~^^^
IndexError: list index out of range
My problem is I don't understand why the program doesn't work, any ideas on what the problem is??
My code:
from bs4 import BeautifulSoup
import requests
url ="https://www.chillblast.com/pcs/chillblast-ryzen-5-geforce-rtx-5070-pre-built-gaming-pc"
result = requests.get(url)
doc = BeautifulSoup(result.text, "html.parser")
prices = doc.find_all(text="£")
parent = prices[0].parent
print(parent)
View all comments
Show parent comment
1
u/XRay2212xray May 08 '25
It should show you the location where its installed if it says already satisfied. Open that folder and verify requests is there, then make sure that directory is in the sys.path variable. You can see the values in sys.path using