You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
439 B
27 lines
439 B
6 months ago
|
import pymysql
|
||
|
import requests
|
||
|
from lxml import etree
|
||
|
import re
|
||
|
|
||
|
def get_news():
|
||
|
headers= {
|
||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
|
||
|
}
|
||
|
url = 'https://news.sina.com.cn/hotnews/#1'
|
||
|
res = requests.get(url=url,headers=headers)
|
||
|
e = res.json()
|
||
|
|
||
|
return e
|
||
|
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
urls=get_news()
|
||
|
print(urls)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|