1
This commit is contained in:
24
数据爬取/import requests.py
Normal file
24
数据爬取/import requests.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup as bs
|
||||
import json
|
||||
headers ={
|
||||
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko)"
|
||||
" Chroe/120.0.0.0 Safari/537.36",
|
||||
}
|
||||
|
||||
url = "https://exam.detr.top/exam-b/movies"
|
||||
|
||||
data = []
|
||||
response = requests.get(url,headers=headers)
|
||||
response.encoding="utf-8"
|
||||
html = response.text
|
||||
#print(response.text)
|
||||
soup = bs(response.text,"html.parser")
|
||||
#print(soup)
|
||||
items= soup.find_all("th",class_="item")
|
||||
for i in range(len(items)):
|
||||
print(i)
|
||||
id = items[i].find("span",class_="meta").get_text()
|
||||
|
||||
title = items[i].find("span",class_="title").get_text()
|
||||
Reference in New Issue
Block a user