您的当前位置:首页正文

python 爬取豆瓣电影250

来源:华佗健康网

目录

准备

网址


1.准备:

打开浏览器找到请求头

 2

网址:

https://movie.douban.com/top250?start=

代码:

# -*- codeing = utf-8 -*-
from bs4 import BeautifulSoup
import re
import urllib.request, urllib.error
import xlwt


findLink = re.compile(r'<a href="(.*?)">')  # 创建正则表达式对象,标售规则   影片详情链接的规则
findImgSrc = re.compile(r'<img.*src="(.*?)"', re.S)
findTitle = re.compile(r'<span class="title">(.*)</span>')
findRating = re.compile(r'<span class="rating_num" property="v:average">(.*)</span>')
findJudg

因篇幅问题不能全部显示,请点此查看更多更全内容