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里的內容 python爬蟲之獲取頁面script里面的內容 [SoapUI] 在SoapUI script里獲取Response(Json格式)某個節點值 python BeautifulSoup4 獲取 script 節點問題 mysql 獲取字段括號里的內容 獲取XML里指定的節點內容信息 js獲取iframe里的body內容 獲取標簽里的純文字內容 執行 innerHTML 里的