下面是使用Python代码实现的方法:

import requests
from bs4 import BeautifulSoup

url = "http://renwen.sanyau.edu.cn/?article/14280.html"
res = requests.get(url)
res.encoding = 'utf-8'
soup = BeautifulSoup(res.text, 'html.parser')

title = soup.select_one('div.article_title > h1').text
print(title)

输出结果:

三亚学院文学院2021年招聘公告
使用requests库和beautifulsoup获取新闻标题 httprenwensanyaueducnarticle14280html

原文地址: https://www.cveoy.top/t/topic/g8gB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录