Python 在beautifulsoup中,如何收集未出现在解析器中的照片链接?

Python 在beautifulsoup中,如何收集未出现在解析器中的照片链接?,python,beautifulsoup,src,Python,Beautifulsoup,Src,在python 3中,我希望从某些页面上的照片中获取链接,例如: 我这样做了: from urllib.request import urlopen from bs4 import BeautifulSoup import urllib.request, urllib.parse, urllib.error html = urlopen('http://divulgacandcontas.tse.jus.br/divulga/#/candidato/2018/2022802018/AC/1

在python 3中,我希望从某些页面上的照片中获取链接,例如:

我这样做了:

from urllib.request import urlopen
from bs4 import BeautifulSoup
import urllib.request, urllib.parse, urllib.error

html = urlopen('http://divulgacandcontas.tse.jus.br/divulga/#/candidato/2018/2022802018/AC/10000600209')
soup = BeautifulSoup(html, "html.parser")
link = soup.find("img", {"class": "img-thumbnail img-responsive dvg-cand-foto"})
print(link)
None

html = urlopen('http://divulgacandcontas.tse.jus.br/divulga/#/candidato/2018/2022802018/SP/250000627809')
soup = BeautifulSoup(html, "html.parser")
link = soup.find("img", {"class": "img-thumbnail img-responsive dvg-cand-foto"})
print(link)
None
我打算收集照片旁边的一组项目,并定义另一种策略,以获得src的确切位置。作为:

但是Firefox浏览器的Inspect元素(img class='img-thumbnail-img-responsive-dvg-cand-foto')中显示的内容与它收集的html.parser不同

请问,有人知道我如何在网站上收集这个照片链接吗

-/-

使用硒:

from selenium import webdriver
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.support.select import Select
from bs4 import BeautifulSoup

profile = webdriver.FirefoxProfile()
browser = webdriver.Firefox(profile)
browser.implicitly_wait(10)

browser.get('http://divulgacandcontas.tse.jus.br/divulga/#/candidato/2018/2022802018/SP/250000627809')

html = browser.page_source
soup = BeautifulSoup(html, "html.parser")
browser.close()

link = soup.find("img", {"class": "img-thumbnail img-responsive dvg-cand-foto"})['src']

print(link)
http://divulgacandcontas.tse.jus.br/candidaturas/oficial/2018/BR/SP/2022802018/250000627809/foto_1534447872273.jpg

非常感谢。我提出了一个可能性
from selenium import webdriver
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.support.select import Select
from bs4 import BeautifulSoup

profile = webdriver.FirefoxProfile()
browser = webdriver.Firefox(profile)
browser.implicitly_wait(10)

browser.get('http://divulgacandcontas.tse.jus.br/divulga/#/candidato/2018/2022802018/SP/250000627809')

html = browser.page_source
soup = BeautifulSoup(html, "html.parser")
browser.close()

link = soup.find("img", {"class": "img-thumbnail img-responsive dvg-cand-foto"})['src']

print(link)
http://divulgacandcontas.tse.jus.br/candidaturas/oficial/2018/BR/SP/2022802018/250000627809/foto_1534447872273.jpg