Issue
Hi I've been trying all day to find a way to download some images from this URL: https://omgcheckitout.com/these-trypophobia-photos-will but when I run this code I always get only the URLs for the small images in the corner and not the ones found in the article. (I've also tried other ways but I get always the same result)
'''
import requests, os
from bs4 import BeautifulSoup as bs
url = 'https://omgcheckitout.com/these-trypophobia-photos-will'
r = requests.get(url)
soup = bs(r.text, "html.parser")
images = soup.find_all('img')
for image in images:
print(images['src'])
'''
Solution
**Converting my comment to an answer
original comment:
"I believe what is happening here is that the page that you are seeing in the browser is being loaded dynamically with javascript. Try typing in '.html' to the page url and see what happens. The images in the redirect are what are being downloaded with your code. I recommend taking a look at this thread https://stackoverflow.com/questions/52687372/beautifulsoup-not-returning-complete-html-of-the-page"
Answered By - B-L
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.