python豆瓣实例,抓取多页数据-应用到知识点:随时数,xpath,间隔请求sleep

源代码:


<!DOCTYPE html>
<html lang="zh-CN" class="ua-windows ua-webkit">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="renderer" content="webkit"><meta name="referrer" content="always"><meta name="google-site-verification" content="ok0wCgT20tBBgo9_zat2iAcimtN4Ftf5ccsh092Xeyw" /><title>
豆瓣电影 Top 250
</title><meta name="baidu-site-verification" content="cZdR4xxR7RxmM4zE" /><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Expires" content="Sun, 6 Mar 2006 01:00:00 GMT"><link rel="apple-touch-icon" href="https://img1.doubanio.com/f/movie/d59b2715fdea4968a450ee5f6c95c7d7a2030065/pics/movie/apple-touch-icon.png"><link href="https://img1.doubanio.com/f/vendors/02814fbb5bee25484516bd0a642af695f7ec5a83/css/douban.css" rel="stylesheet" type="text/css"><link href="https://img1.doubanio.com/f/vendors/ee6598d46af0bc554cecec9bcbf525b9b0582cb0/css/separation/_all.css" rel="stylesheet" type="text/css"><link href="https://img1.doubanio.com/f/movie/cb1cb6aaa244dff6a281d103ff26d445debd130a/dist/movie/base/init.css" rel="stylesheet"><script type="text/javascript">var _head_start = new Date();</script><script type="text/javascript" src="https://img1.doubanio.com/f/vendors/0511abe9863c2ea7084efa7e24d1d86c5b3974f1/js/jquery-1.10.2.min.js"></script><script type="text/javascript" src="https://img1.doubanio.com/f/vendors/aa9559674f2476cdc16f755b3cdc4ebc478db669/js/douban.js"></script><script type="text/javascript" src="https://img1.doubanio.com/f/vendors/b0d3faaf7a432605add54908e39e17746824d6cc/js/separation/_all.js"></script><link href="https://img1.doubanio.com/f/movie/cc39edebfb5def77e34478f63618b37c894e5499/dist/movie/charts/top_movies.css" rel="stylesheet" type="text/css" /><style type="text/css">
.site-nav-logo img{margin-bottom:0;}
</style><style type="text/css">img { max-width: 100%; }</style><script type="text/javascript"></script><style type="text/css">.item .playable {font-size: 13px; padding-left: 3px; color: #00A65F;}.tabs {overflow: hidden;float: left;}.tabs a,.tabs span {display: block;float: left;height: 25px;line-height: 25px;padding: 0 15px;-webkit-border-radius: 3px;border-radius: 3px;font-size: 13px;}.tabs a:hover {background: none;color: #37a;}.tabs span {background: #268dcd;color: #fff;}.opt {margin-top: 15px;padding-bottom: 0;}.mod #mine-selector {display: block;margin-top: 6px;float:right;color: #666666;font-size: 12px;}
</style><link rel="shortcut icon" href="https://img1.doubanio.com/favicon.ico" type="image/x-icon">
</head><body><script type="text/javascript">var _body_start = new Date();</script><link href="//img3.doubanio.com/dae/accounts/resources/ded47ae/shire/bundle.css" rel="stylesheet" type="text/css"><div id="db-global-nav" class="global-nav"><div class="bd"><div class="top-nav-info"><a href="https://accounts.douban.com/passport/login?source=movie" class="nav-login" rel="nofollow">登录/注册</a>
</div><div class="top-nav-doubanapp"><a href="https://www.douban.com/doubanapp/app?channel=top-nav" class="lnk-doubanapp">下载豆瓣客户端</a><div id="doubanapp-tip"><a href="https://www.douban.com/doubanapp/app?channel=qipao" class="tip-link">豆瓣 <span class="version">6.0</span> 全新发布</a><a href="javascript: void 0;" class="tip-close">×</a></div><div id="top-nav-appintro" class="more-items"><p class="appintro-title">豆瓣</p><p class="qrcode">扫码直接下载</p><div class="download"><a href="https://www.douban.com/doubanapp/redirect?channel=top-nav&direct_dl=1&download=iOS">iPhone</a><span>·</span><a href="https://www.douban.com/doubanapp/redirect?channel=top-nav&direct_dl=1&download=Android" class="download-android">Android</a></div></div>
</div><div class="global-nav-items"><ul><li class=""><a href="https://www.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-main&quot;,&quot;uid&quot;:&quot;0&quot;}">豆瓣</a></li><li class=""><a href="https://book.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-book&quot;,&quot;uid&quot;:&quot;0&quot;}">读书</a></li><li class="on"><a href="https://movie.douban.com"  data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-movie&quot;,&quot;uid&quot;:&quot;0&quot;}">电影</a></li><li class=""><a href="https://music.douban.com" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-music&quot;,&quot;uid&quot;:&quot;0&quot;}">音乐</a></li><li class=""><a href="https://www.douban.com/location" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-location&quot;,&quot;uid&quot;:&quot;0&quot;}">同城</a></li><li class=""><a href="https://www.douban.com/group" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-group&quot;,&quot;uid&quot;:&quot;0&quot;}">小组</a></li><li class=""><a href="https://read.douban.com&#47;?dcs=top-nav&amp;dcm=douban" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-read&quot;,&quot;uid&quot;:&quot;0&quot;}">阅读</a></li><li class=""><a href="https://fm.douban.com&#47;?from_=shire_top_nav" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-fm&quot;,&quot;uid&quot;:&quot;0&quot;}">FM</a></li><li class=""><a href="https://time.douban.com&#47;?dt_time_source=douban-web_top_nav" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-time&quot;,&quot;uid&quot;:&quot;0&quot;}">时间</a></li><li class=""><a href="https://market.douban.com&#47;?utm_campaign=douban_top_nav&amp;utm_source=douban&amp;utm_medium=pc_web" target="_blank" data-moreurl-dict="{&quot;from&quot;:&quot;top-nav-click-market&quot;,&quot;uid&quot;:&quot;0&quot;}">豆品</a></li></ul>
</div></div>
</div>
<script>;window._GLOBAL_NAV = {DOUBAN_URL: "https://www.douban.com",N_NEW_NOTIS: 0,N_NEW_DOUMAIL: 0};
</script><script src="//img3.doubanio.com/dae/accounts/resources/ded47ae/shire/bundle.js" defer="defer"></script><link href="//img3.doubanio.com/dae/accounts/resources/ded47ae/movie/bundle.css" rel="stylesheet" type="text/css"><div id="db-nav-movie" class="nav"><div class="nav-wrap"><div class="nav-primary"><div class="nav-logo"><a href="https:&#47;&#47;movie.douban.com">豆瓣电影</a></div><div class="nav-search"><form action="https:&#47;&#47;search.douban.com&#47;movie/subject_search" method="get"><fieldset><legend>搜索:</legend><label for="inp-query"></label><div class="inp"><input id="inp-query" name="search_text" size="22" maxlength="60" placeholder="搜索电影、电视剧、综艺、影人" value=""></div><div class="inp-btn"><input type="submit" value="搜索"></div><input type="hidden" name="cat" value="1002" /></fieldset></form></div></div></div><div class="nav-secondary"><div class="nav-items"><ul><li    ><a href="https://movie.douban.com/cinema/nowplaying/">影讯&购票</a></li><li    ><a href="https://movie.douban.com/explore">选电影</a></li><li    ><a href="https://movie.douban.com/tv/">电视剧</a></li><li    ><a href="https://movie.douban.com/chart">排行榜</a></li><li    ><a href="https://movie.douban.com/review/best/">影评</a></li><li    ><a href="https://movie.douban.com/annual/2023/?fullscreen=1&source=navigation">2023年度榜单</a></li><li    ><a href="https://c9.douban.com/app/standbyme-2023/?autorotate=false&fullscreen=true&hidenav=true&monitor_screenshot=true&source=web_navigation"target="_blank">2023年度报告</a></li></ul>
</div><a href="https://movie.douban.com/annual/2023/?fullscreen=1&source=movie_navigation" class="movieannual"></a></div>
</div><script id="suggResult" type="text/x-jquery-tmpl"><li data-link="{{= url}}"><a href="{{= url}}" onclick="moreurl(this, {from:'movie_search_sugg', query:'{{= keyword }}', subject_id:'{{= id}}', i: '{{= index}}', type: '{{= type}}'})"><img src="{{= img}}" width="40" /><p><em>{{= title}}</em>{{if year}}<span>{{= year}}</span>{{/if}}{{if sub_title}}<br /><span>{{= sub_title}}</span>{{/if}}{{if address}}<br /><span>{{= address}}</span>{{/if}}{{if episode}}{{if episode=="unknow"}}<br /><span>集数未知</span>{{else}}<br /><span>共{{= episode}}集</span>{{/if}}{{/if}}</p></a></li></script><script src="//img3.doubanio.com/dae/accounts/resources/ded47ae/movie/bundle.js" defer="defer"></script><div id="wrapper"><div id="content"><h1>豆瓣电影 Top 250</h1><div class="grid-16-8 clearfix"><div class="article"><div class="opt mod"><div class="tabs"></div><span id="mine-selector"><input type="checkbox"  value="unwatched">我没看过的</span>
</div><ol class="grid_view"><li><div class="item"><div class="pic"><em class="">1</em><a href="https://movie.douban.com/subject/1292052/"><img width="100" alt="肖申克的救赎" src="https://img3.doubanio.com/view/photo/s_ratio_poster/public/p480747492.webp" class=""></a></div><div class="info"><div class="hd"><a href="https://movie.douban.com/subject/1292052/" class=""><span class="title">肖申克的救赎</span><span class="title">&nbsp;/&nbsp;The Shawshank Redemption</span><span class="other">&nbsp;/&nbsp;月黑高飞(港)  /  刺激1995(台)</span></a><span class="playable">[可播放]</span></div><div class="bd"><p class="">导演: 弗兰克·德拉邦特 Frank Darabont&nbsp;&nbsp;&nbsp;主演: 蒂姆·罗宾斯 Tim Robbins /...<br>1994&nbsp;/&nbsp;美国&nbsp;/&nbsp;犯罪 剧情</p><div class="star"><span class="rating5-t"></span><span class="rating_num" property="v:average">9.7</span><span property="v:best" content="10.0"></span><span>2966655人评价</span></div><p class="quote"><span class="inq">希望让人自由。</span></p></div></div></div></li><li><div class="item"><div class="pic"><em class="">2</em><a href="https://movie.douban.com/subject/1291546/"><img width="100" alt="霸王别姬" src="https://img1.doubanio.com/view/photo/s_ratio_poster/public/p2561716440.webp" class=""></a></div><div class="info"><div class="hd"><a href="https://movie.douban.com/subject/1291546/" class=""><span class="title">霸王别姬</span><span class="other">&nbsp;/&nbsp;再见,我的妾  /  Farewell My Concubine</span></a><span class="playable">[可播放]</span></div><div class&

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/603335.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Calibre PEX Hspice Netlist提取步骤(数模芯片提取spice netlist流程)

在数模混合芯片中&#xff0c;通常模拟需要数字模块通过calibre工具来提取Hspice netlist用于功耗仿真。注意这里的spice netlist和做Calibre的spice netlist是不太一样的。 另外在做calibre pex时需要确保当前的design LVS已经pass。否则功耗仿真可能会不准。 Calibre LVS常…

八. 实战:CUDA-BEVFusion部署分析-spconv原理

目录 前言0. 简述1. 举例分析spconv的计算流程2. 导出带有spconv网络的onnx需要考虑的事情总结下载链接参考 前言 自动驾驶之心推出的 《CUDA与TensorRT部署实战课程》&#xff0c;链接。记录下个人学习笔记&#xff0c;仅供自己参考 本次课程我们来学习下课程第八章——实战&a…

【数据库原理】(13)视图的使用

文章目录 一.定义和删除视图1.建立视图2.删除视图 二.查询视图视图查询的基本操作视图查询的内部机制查询转换的注意事项视图查询的限制 三.更新视图1.插入视图数据2.删除视图数据3.修改视图数据可更新性的限制 视图&#xff08;View&#xff09; 是一种虚拟的表&#xff0c;它…

Next.js 第一次接触

因为需要整个漂亮的在线文档&#xff0c;所以接触了next.js&#xff0c;因为对前端js本身不够熟悉&#xff0c;别说对react.js 又不会&#xff0c;时间又不允许深入研究&#xff0c;所以&#xff0c;为了加一个导航菜单&#xff0c;极其痛苦。 有点小bug&#xff0c;不过不影响…

学习笔记:C++之 switch语句

Switch语句 作用&#xff1a;执行多条件分支语句 语法&#xff1a; switch&#xff08;表达式&#xff09;{ case 结果1&#xff1a;执行语句&#xff1b;break&#xff1b; case 结果2&#xff1a;执行语句&#xff1b;break&#xff1b; ... default&#xff1a;执行语句&a…

Golang leetcode142 环形链表 暴力map 快慢指针法

文章目录 环形链表 leetcode142暴力遍历 map哈希记录快慢指针法 环形链表 leetcode142 该题目要求找到入环的第一个节点 我们可以通过map进行记录&#xff0c;没到新的节点查询是否经过原有节点 入环节点&#xff0c;上两个节点的next相同 若有入环节点&#xff0c;则一定能检…

如何用python实现一个简单的单向链表?

实现一个简单的单向链表涉及两个基本的构建块&#xff1a;节点&#xff08;Node&#xff09;和链表&#xff08;LinkedList&#xff09;。下面是详细步骤和解释&#xff1a; 1. 实现节点&#xff08;Node&#xff09; 链表中的每个节点通常包含两部分&#xff1a;存储的数据&…

Flutter 图片和资源的高效使用指南

文章目录 指定资源什么是 [pubspec.yaml](https://dart.cn/tools/pub/pubspec) 文件 图片图片常用的配置属性加载本地图片通过 pubspec.yml 文件进行配置图片目录使用 Image.asset 小部件加载本地图片 加载网络图片通过 Image.network小部件加载网络图片&#xff1a;使用Image.…

LeCode:(606. 根据二叉树创建字符串)

题目链接 本体的难点&#xff1a; 什么时候去打印左右括号&#xff1f;什么时候省略&#xff1f; 解题过程&#xff1a;通过观察看到&#xff0c;每次遍历结点之前&#xff0c;打印了一个左括号&#xff1b;遍历到叶子&#xff0c;叶子的左右也要打印出括号来&#xff08;先…

linux虚拟机环境快速搭建redis5.x版本的主从集群总结

原创/朱季谦 我在阿里云服务器上曾参与过公司redis集群的搭建&#xff0c;但时间久了&#xff0c;都快忘记当时的搭建过程了&#xff0c;故而决定在虚拟机centOS 7的环境&#xff0c;自行搭建一套redis5.x版本的集群&#xff0c;该版本集群的搭建比较方便&#xff0c;不用再像…

实现电子邮件自动化的实用技巧与指南

如何实现电子邮件自动化&#xff1f;一般可以通过规则和过滤器、自动回复、定时发送、快捷键和模板、团队邮箱等方法来实现。 一、什么是电子邮件自动化 电子邮件自动化是一种根据特定条件在适当时机发送正确信息的过程。这些条件可以是时间表、触发器或在您的电子邮件自动化工…

AVL树介绍以及代码实现

二叉搜索树的查找和删除虽然最优情况下能够做到 O(logN) 的级别&#xff0c;但是在一些特殊情况下&#xff0c;它的查找速度只能到达 O(N)级别&#xff0c;比如数据按顺序插入&#xff0c;那么就一定是一棵单边树。 为了针对这种情况&#xff0c;俄罗斯的两位数学家&#xff1a…

android 倒计时控件

效果&#xff1a;&#xff08;可不设置 之前、之后文字&#xff09; /*** 倒计时秒数** desc : 时分秒倒计时view* * 布局里引用后&#xff0c;* private fun testMethod(){* binding.test.setCDownStarText("之前的文字")* binding.test.setCDo…

在数据库造数据发现的bug也是bug

上个月&#xff0c;我和开发小哥讨论过一个问题&#xff0c;开发小哥专门提醒我&#xff0c;页面上新增功能尽可能在前端造一些数据去测试&#xff0c;如果直接从数据库里插入的数据&#xff0c;定位问题还是有些说不清楚。 讨论的过程和细节就是以下的对话内容&#xff1a; …

【Sublime Text】| 02——常用插件安装及配置

系列文章目录 【Sublime Text】| 01——下载软件安装并注册 【Sublime Text】| 02——常用插件安装及配置 失败了也挺可爱&#xff0c;成功了就超帅。 文章目录 1. 汉化2. 更换颜色主题3. 更改编码插件—ConvertToUTF84. 对齐插件—Alignment5. 括号高亮插件—BracketHighligh…

网络嗅探器的设计与实现(2024)-转载

1.题目描述 参照 raw socket 编程例子&#xff0c;设计一个可以监视网络的状态、数据流动情况以及网络上传输 的信息的网络嗅探器。 2.运行结果 3.导入程序需要的库 请参考下面链接: 导入WinPcap到Clion (2024)-CSDN博客 4.参考代码 #define HAVE_REMOTE #define LINE_LEN …

XSKY SDS 产品率先获得 OceanBase V4 新版本认证

近日&#xff0c;北京奥星贝斯科技有限公司&#xff08;简称&#xff1a;OceanBase&#xff09;与北京星辰天合科技股份有限公司&#xff08;简称&#xff1a;XSKY 星辰天合&#xff09;顺利完成产品兼容性认证。 XSKY 的高性能全闪存储以及混闪存储&#xff0c;与 OceanBase V…

ELement UI时间控件el-date-picker误差8小时解决办法

一、问题描述&#xff1a; 在项目中引用了elementui中的date-picker组件&#xff0c;选中的时间跟实际相差八小时&#xff0c;且格式不是自己想要的格式 <el-date-pickertype"date"placeholder"选择日期"format"yyyy/M/d"v-model"form…

Java面试之集合篇

前言 本篇主要总结JAVA面试中关于集合相关的高频面试题。本篇的面试题基于网络整理以及自己的总结编辑。在不断的完善补充哦。欢迎小伙伴们在评论区发表留言哦&#xff01; 1、基础 1.1、Java 集合框架有哪些&#xff1f; Java 集合框架&#xff0c;大家可以看看 《Java 集…

报错处理:java.io.IOException: Could not find resource mybatis-config.xml

运行mybatis文件时出现了以下的情况 java.io.IOException: Could not find resource mybatis-config.xmlat org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:114)at org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:100)at org.apach…