上传文件至 /

This commit is contained in:
2026-03-31 11:33:03 +08:00
parent cb95fedab1
commit e69a7e11c5
5 changed files with 1596 additions and 1581 deletions

View File

@@ -1,23 +1,23 @@
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
url = 'https://movie.douban.com/top250'
print('开始爬取豆瓣电影Top250...')
response = requests.get(url, headers=headers)
print(f'状态码: {response.status_code}')
print(f'内容长度: {len(response.text)} 字符')
html = response.text
title_pattern = r'<span class="title">([^<]+)</span>'
titles = re.findall(title_pattern, html)
chinese_titles = [t for t in titles if not t.startswith('/')]
print('电影名称前10部')
for i, title in enumerate(chinese_titles[:10], 1):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
url = 'https://movie.douban.com/top250'
print('开始爬取豆瓣电影Top250...')
response = requests.get(url, headers=headers)
print(f'状态码: {response.status_code}')
print(f'内容长度: {len(response.text)} 字符')
html = response.text
title_pattern = r'<span class="title">([^<]+)</span>'
titles = re.findall(title_pattern, html)
chinese_titles = [t for t in titles if not t.startswith('/')]
print('电影名称前10部')
for i, title in enumerate(chinese_titles[:10], 1):
print(f'{i}. {title}')