I need to parse a webpage and it has a lot of images, each request takes a lot of time because of it.
Can I use requests.get to get only html content without waiting for images?
When you GET a page, you only download the page itself anyway.
import requests
url = 'https://stackoverflow.com/questions/40394209/python-requests-how-to-get-a-page-without-downloading-all-images'
# This will yield only the HTML code
response = requests.get(url)
print(response.text)
The page HTML contains references to images, but the GET request does not follow them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With