I'm trying to grab all the images from this webpage using requests. When I run the script that I've created so far is not getting anything at all. Although the images are available within page source, I can't get this script to work. I wish to scrape all the images which show up while scrolling to the bottom. I also noticed that some link https://www.pexels.com/sv-se/sok/office/?format=js&seed=&page=4&type= found in the dev tools generating all the content incrementing the page number attached to it. But I failed to produce images making use of that link as well.
I've written so far:
import requests
from bs4 import BeautifulSoup
url = 'https://www.pexels.com/sv-se/sok/office/'
with requests.Session() as s:
s.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36'
s.headers['referer'] = 'https://www.pexels.com/sv-se/'
r = s.get(url)
soup = BeautifulSoup(r.text,"lxml")
for item in soup.select("a.photo-item__link > img.photo-item__img"):
print(item['data-large-src'])
How can I grab all the image links from that webpage using requests?
