python获取script里的内容


import requests
from bs4 import BeautifulSoup

url1 = "https://mip.keoaeic.org/journal_skills/6616.html"
html = requests.get(url1).content
html=html.decode('utf-8') # python3
soup = BeautifulSoup(html, "html.parser")
a = soup.select('script[type="application/ld+json"]') 
#查找<script[type="application/ld+json"]> 里面的内容,因为这个地址上面有多个相同的,只需要获取对应的下标内容即可。

t = list(a)[0].text
print(r)

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 python爬虫之获取页面script里面的内容 获取标签里的纯文字内容 执行 innerHTML 里的