1
This commit is contained in:
35
35.py
Normal file
35
35.py
Normal file
@@ -0,0 +1,35 @@
|
||||
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) "
|
||||
"Chrome/129.0.0.0 Safari/537.36"
|
||||
}
|
||||
|
||||
ur1 ="https://exam.detr.top/exam-b/movies"
|
||||
|
||||
data =[]
|
||||
|
||||
resp = requests.get(ur1,headers = headers)
|
||||
resp.encoding = 'utf-8'
|
||||
# print(resp.text)
|
||||
soup = bs(resp.text,"html.parser")
|
||||
#print(soup)
|
||||
|
||||
items = soup.find_all("tr")
|
||||
cnt = 1
|
||||
print(items)
|
||||
for item in items:
|
||||
print(item)
|
||||
print('-----------')
|
||||
for i in item:
|
||||
title =item.find("td").get_text().split("电影名")[1].split("\n")[0]
|
||||
|
||||
print(item)
|
||||
|
||||
|
||||
|
||||
# rank = int(item.find("em").get_text())
|
||||
# title = item.find("td").get_text()
|
||||
Reference in New Issue
Block a user