I am trying to scrape images from IMDB, but I am unable to get their URLs. The IMDB has load late in their image URLs and I do not know how to proceed further with this. So can you please help me?
from bs4 import BeautifulSoup
import requests
import urllib
from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
mimg = []
imdb_link = "https://www.imdb.com/search/title/?groups=top_250&sort=user_rating,desc&count=250"
opts = Options()
opts.add_argument("--headless")
opts.binary_location = 'C:\Program Files\Google\Chrome\Application\chrome.exe'
chrome_driver = 'C:\Project\chromedriver.exe'
driver = webdriver.Chrome(options=opts, executable_path=chrome_driver)
element = WebDriverWait(driver, 3)
driver.get(imdb_link)
time.sleep(2)
rmsoup = driver.page_source
time.sleep(2)
time.sleep(2)
time.sleep(2)
relsoup = BeautifulSoup(rmsoup, features='lxml')
driver.close()
for img in relsoup.findAll('img'):
mimg.append(img.get('src'))
print(mimg)