女生名叫黄蒲军校
Severe Drought Causing Ruins of Ancient Roman Bridge Built Under Nero's Reign to Reemerge From Tiber_我的网站

A |
阿里云优惠券 先领券再下单 前面有写过一篇瀑布流的采集方法,今天在添加一个POST方法来采集Ajax刷新页面的教程。 之前的文章请看:火车头采集动态加载Ajax数据(无分页瀑布流网站) 如果遇到POST方法来架子Ajax数据,这和我之前写的是两个类型,瀑布流是直接刷新出数据的页面。 采集网站分析 采集任何一个新站前我们都要对他进行一番分析才好下手。 An ancient bridge built during the reign of the Roman Emperor Nero has recently emerged from the waters of the Tiber River that usually conceal it, Libero Tecnologia reports.,According to the media outlet, the bridge, whose construction was actually ordered by Nero’s predecessor Caligula, was demolished in 500 AD in order to prevent the Goths from entering and plundering the city, and the remains of the structure have since rested beneath the flowing waters of the Tiber, only reemerging on rare occasions when water level in the river falls “too low.”,The development, Libero Tecnologia warns, is actually a worrisome sign, as Rome and the entirety of Lazio are “on drought alarm,” and the water level in the Tiber had dropped by six centimeters in six days, reaching a state that has only been “seen a few times before.”,Namely, the depth of the Tiber dropped to 1.12 meters this month, while normally it should be between 4 and 5.5 meters.,The situation has occurred amid a lack of rainfall in Rome – the media outlet states that it hasn’t rained there for over a month.,Meanwhile, Nicola Zingaretti, the president of Lazio, reportedly declared a “state of natural disaster,” with local residents and companies being advised not to waste water.。

B | 列表页分析 这个网站的列表页,前面并不是通过Ajax加载的。

C | CTRL+U可以直接看到列表内容,通过浏览器也看不到相关请求地址。


因为习惯原因,我直接看了下尾页列表页。

D | 然后顺手CTRL+U看看网站代码结构有没有大的变化。防止后期采集出错。结果就发现无法看到列表内容。浏览器可以看到一个通过post请求的地址。

E |


这时候就意识到这网站列表页可能后面的应该全是通过Ajax加载的。 通过笨方法,手动访问页面看看Ajax加载大概是哪些。

F | 最后找到大概从2200页左右开始Ajax加载。 那我们采集的时候,前面的列表页就可以使用普通方式去采集(速度更快)。 2200页开始到尾页就通过post请求Ajax页面数据。

G | 抓包获取Post数据 这个Ajax地址我在浏览器看不到任何跟页码有关的数据。最后只能使用抓包工具看一下详细的请求内容了。

使用抓包工具Fiddler
Fiddler下载地址:OneDrive-Fiddler-Setup_v5.0.20204.45441.zip 安装设置完成后我们打开浏览器。

H | 重新访问一下采集页面,Fiddler会抓到很多请求地址。 查看分析Post数据 Ctrl+F 我们搜索那个Ajax地址

Fiddler会以黄色将搜索到的结果显示出来,我们点击一下他。

在Fiddler右侧会显示这个请求地址的相关详细信息。

信息顶部可以看到是post请求方法。

I | 可以看到有我们请求的页码相关内容。

访问不同页码的页面,经过研究发现规律。

currentPageIndex的值和页码相关,值等于页码减一。我们访问6139页时,currentPageIndex值是6138。 这就找到了规律,我们打开火车头采集器。 火车头采集器配置分页设置 起始网址填入Ajax请求地址

点“高级模式”。

点“分页设置”,http请求方式“post”。

把我们Fiddler抓包获取的内容填进去。

将currentPageIndex值的内容替换成火车头采集器的“分页”标签。

下面填入页码。 页面地址是从2200到6140,上面我们分析得出post请求内容的currentPageIndex值是实际页码减一。

J | 所以这里面我们填2199到6139.

网址获取选项设置 为了筛选出我们需要的内容,我们设置一下网址获取选项。 打开浏览器F12开发工具,预览一下Ajax获取的内容。

K |

可以看到链接的形式是
自考成考报名条件有哪些? 完整的链接地址是 https://域名/chengrenzikao/20200611152022.html 那我们就可以使用下面的规则提取地址。
我们测试一下网址采集。 测试网址采集 点击测试可能提示“post请求必须选择网页编码”我们在火车头其他设置中将编码选为“UTF8”即可。
可以看到已经正确获取到了链接。不放心可以复制链接实际访问一下看看是否正确。
注意事项 采集过程注意运行线程和请求间隔时间。教程在测试时因为开的线程较多,频率过高导致对方网站开启了防CC设置。拉黑了我一个服务器IP,此教程写完用了两台服务器。
L | 我们实际采集可以只开1个线程,并设置合适的间隔时间,比如1000ms到1500ms左右。 本文来自2号站长网,转载请注明出处:https://www.zz2zz.com/331414.html
申请创业报道,分享创业好点子。点击此处,共同探讨创业新机遇!。
Current article:http://epiom.tandianxiuzhutiaoshoudiamei.pics/ivm2xx/s6p.html
Published on:17:15:44