python新闻列表 内容爬取,需要先获取到每一个内容的连接

日期:2021-02-05 14:16 来源:原创 作者:小霍 点击:

for item in news:
        item_url = item.find('a', class_='news-item-title')['href']
        title = item.find('a', class_='news-item-title').text

        response1 = requests.get(item_url)
        soup1 = BeautifulSoup(response1.content, 'lxml')
        text = soup1.find('div', class_='article-detail-cnt').text


标签:

Copyright © 2019.Company name All rights reserved. 冀ICP备14010059号-4 网站地图