上传文件至 /
This commit is contained in:
23
260324 09林贵珍
Normal file
23
260324 09林贵珍
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
|
||||||
|
}
|
||||||
|
|
||||||
|
url = 'https://movie.douban.com/top250?start=25&filter='
|
||||||
|
|
||||||
|
response = requests.get(url,headers=headers,timeout=10)
|
||||||
|
response.encoding = 'utf-8'
|
||||||
|
|
||||||
|
# print(response.status-code)
|
||||||
|
|
||||||
|
soup = BeautifulSoup(response.text,'html.parser')
|
||||||
|
|
||||||
|
movies = []
|
||||||
|
|
||||||
|
for item in soup.find_all('div',class_='hd'):
|
||||||
|
a = item.find('a')
|
||||||
|
if a:
|
||||||
|
print(a.get_text(strip=True))
|
||||||
|
|
||||||
Reference in New Issue
Block a user