写一段爬取此网站的代码https://ys.endata.cn/Details/Movie?entId=692258
时间: 2023-07-14 15:52:23 浏览: 61
好的,以下是一个简单的 Python 代码,可以爬取该网站上电影《误杀》的相关信息:
```python
import requests
from bs4 import BeautifulSoup
url = 'https://ys.endata.cn/Details/Movie?entId=692258'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'html.parser')
title = soup.find('h2', {'class': 'media-heading'}).text.strip()
score = soup.find('strong', {'class': 'rating'}).text.strip()
release_date = soup.find('span', {'class': 'release-date'}).text.strip()
director = soup.find('a', {'class': 'director'}).text.strip()
actors = [a.text.strip() for a in soup.find_all('a', {'class': 'actor'})]
print('电影名称:', title)
print('电影评分:', score)
print('上映日期:', release_date)
print('导演:', director)
print('演员:', actors)
```
注意:该代码仅供学习和参考使用,请勿用于商业用途或非法用途。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![dmg](https://img-home.csdnimg.cn/images/20210720083646.png)