抓取动态页面

导入一个selenium模块

pip install selenium

抓取淘女郎网站的动态生成的图片:

from  selenium import webdriver
from bs4 import BeautifulSoup

def main():
    driver = webdriver.Chrome()
    driver,get('https://v.taobao.com/v/content/live?catetype=704&from=taonvlang')
    soup = BeautifulSoup(driver.page_source,'lxml')
    for img_tag in soup.select('img[src]'):
        print(img_tag.attrs['src'])



if __name__ = '__main__':
    main()

猜你喜欢

转载自blog.csdn.net/qq_40861391/article/details/80542007
今日推荐