diff --git a/260324 09林贵珍 b/260324 09林贵珍 new file mode 100644 index 0000000..6460ef7 --- /dev/null +++ b/260324 09林贵珍 @@ -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)) +