📜  bs4 从脚本标签获取文本 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:45.406000             🧑  作者: Mango

代码示例1
from bs4 import BeautifulSoup
import requests

link = 'https://stackoverflow.com/jobs?med=site-ui&ref=jobs-tab&sort=p'
r = requests.get(link)
soup = BeautifulSoup(r.text, 'html.parser')

s = soup.find('script', type='application/ld+json')

# JUST THIS
json = json.loads(s.string)