按照:https://dryscrape.readthedocs.io/en/latest/installation.html

安装dryscrape 

以下是简单实现

import dryscrape
from bs4 import BeautifulSoup

# 使用dryscrape库 动态抓取页面
def get_url_dynamic(url):
    dryscrape.start_xvfb()
    session_req=dryscrape.Session()
    session_req.visit(url) #请求页面
    response=session_req.body() #网页的文本
    soup = BeautifulSoup(response, "html.parser")
    for k in soup.find_all('a'):
        print(k)
    # print(soup.prettify())
    return response
get_url_dynamic('https://www.cnblogs.com/sweetsunnyflower/p/11156056.html')

  

 

使用 pymysql 操作数据库

相关文章:

  • 2022-12-23
  • 2021-12-27
  • 2021-09-22
  • 2021-09-15
  • 2021-07-19
  • 2021-12-16
  • 2021-11-27
猜你喜欢
  • 2021-10-13
  • 2021-12-10
  • 2022-01-24
  • 2021-08-29
  • 2021-12-20
  • 2021-12-12
  • 2022-12-23
相关资源
相似解决方案