常見網站的多頁情況
一、 翻頁規律為1、2、3、4等遞增變化時,翻頁規律為每頁增加1,則其多頁采集時,以10頁為目標,采集規則為{{1-10;1}}
二、 翻頁規律為奇數/偶數變化時,即每頁網址頁碼為:1、3、5、7等奇數頁碼或者0、2、4、6、8等偶數頁碼時,其翻頁規律為每頁增加2的翻頁規律.
以10頁為采集目標,奇數頁碼規則為{{1-19;2}} 同理,當目標網站翻頁規則為偶數頁碼時,多頁采集規則為{{0-18;2}}
三、 翻頁規律為一定數字/步長的,每頁網站頁碼的變化為一個固定數字,即每增加一頁,頁碼增加一個固定數字N。
以淘寶網-手機搜索結果的頁碼變化為例:淘寶網的頁碼變化規律為每增加一頁,增加48.則采集淘寶前10頁的數據時翻頁規律為{{0-432;48}}
舉例說明
一、翻頁規律為1、2、3、4等遞增變化時,翻頁規律為每頁增加1,則其多頁采集時,以N頁為目標,采集規則為{{1-N;1}}
以鏈家網-二手房網頁多頁翻頁規則為例:
第一頁:https://bj.lianjia.com/ershoufang/pg1/
第二頁:https://bj.lianjia.com/ershoufang/pg2/
第三頁:https://bj.lianjia.com/ershoufang/pg3/
以10頁為采集目標,其多頁采集設置為:https://bj.lianjia.com/ershoufang/pg{{1-10;1}}/
二、翻頁規律為奇數/偶數變化時,即每頁網址頁碼為:1、3、5、7等奇數頁碼或者0、2、4、6、8等偶數頁碼時,其翻頁規律為每頁增加2的翻頁規律.
奇數頁碼翻頁規則為2N-1,N=目標頁碼
以京東為例:
第一頁 (2N-1);N=1時,第一頁的頁碼為2*1-1=1
https://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page=1&s=1&click=0
第二頁 N=2時,page2= 2*2-1=3
https://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page=3&s=60&click=0
第三頁 N=3時,page3=2*3-1=5:
https://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page=5&s=114&click=0
則以10頁為采集目標,京東多頁采集規則設置為{{1-19;2}} 在造數多頁采集時應該設置的網址鏈接為:
https://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&wq=%E6%89%8B%E6%9C%BA&cid2=653&cid3=655&page={{1-19;2}}&s=114&click=0
同理,當目標網站翻頁規則為偶數頁碼時,翻頁規則為2(N-1),N=網頁頁碼
多頁采集規則為:{{0-2(N-1);2}},N=網頁頁碼
三、翻頁規律為一定數字/步長的,即每頁網站頁碼的變化為一個固定數字。
以淘寶網-手機搜索結果的頁碼變化為例:
淘寶網的頁碼變化規律為每增加一頁,頁碼數字增加48
第一頁 頁碼=0:
實際第一頁的隱藏頁碼鏈接為頁碼=48*(1-1)=0
第二頁 頁碼=48*(2-1)=48
第三頁頁碼=48*(3-1)=96
第四頁頁碼=48*(4-1)=144
第10頁頁碼=48(10-1)=432
第N頁頁碼=48(N-1)
則前10頁的多頁采集規則為:{{0-432;48}} 在造數多頁采集時應該設置的網址鏈接為:
更多示例
1、京東搜索手機時多頁設置
網址是:
http://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&cid2=653&cid3=655&page=3
http://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&cid2=653&cid3=655&page=5
http://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&cid2=653&cid3=655&page=7
那么京東的翻頁規則就是:
http://search.jd.com/Search?keyword=%E6%89%8B%E6%9C%BA&enc=utf-8&qrst=1&rt=1&stop=1&vt=2&cid2=653&cid3=655&page={{1-19;2}}
2、百度造數時的多頁設置
網址是:
https://www.baidu.com/s?wd=造數&pn=10
https://www.baidu.com/s?wd=造數&pn=20
https://www.baidu.com/s?wd=造數&pn=30
那么百度的翻頁規則就是:
https://www.baidu.com/s?wd=造數&pn={{0-90;10}}
3、拉勾搜索JAVA時多頁設置
網址是:
https://www.lagou.com/zhaopin/Java/2/
https://www.lagou.com/zhaopin/Java/3/
https://www.lagou.com/zhaopin/Java/4/
那么拉勾的翻頁規則就是:
https://www.lagou.com/zhaopin/Java/{{1-10}}/
4、大眾點評搜索火鍋時多頁設置
網址是:
http://www.dianping.com/search/category/16/10/g110p2
http://www.dianping.com/search/category/16/10/g110p3
http://www.dianping.com/search/category/16/10/g110p4
那么大眾點評的翻頁規則就是:
http://www.dianping.com/search/category/16/10/g110p{{1-10}}
5、知乎精華問題的多頁設置
網址是:
https://www.zhihu.com/topic/19551147/top-answers?page=2
https://www.zhihu.com/topic/19551147/top-answers?page=3
https://www.zhihu.com/topic/19551147/top-answers?page=4
那么知乎的翻頁規則就是:
https://www.zhihu.com/topic/19551147/top-answers?page={{1-10}}
6、亞馬遜搜索手機時多頁設置
網址是:
https://www.amazon.cn/s/ref=sr_pg_2?rh=n%3A664978051%2Cn%3A665002051%2Ck%3A%E6%89%8B%E6%9C%BA&page=2&keywords=%E6%89%8B%E6%9C%BA&ie=UTF8&qid=1510642070
https://www.amazon.cn/s/ref=sr_pg_2?rh=n%3A664978051%2Cn%3A665002051%2Ck%3A%E6%89%8B%E6%9C%BA&page=3&keywords=%E6%89%8B%E6%9C%BA&ie=UTF8&qid=1510642070
https://www.amazon.cn/s/ref=sr_pg_2?rh=n%3A664978051%2Cn%3A665002051%2Ck%3A%E6%89%8B%E6%9C%BA&page=4&keywords=%E6%89%8B%E6%9C%BA&ie=UTF8&qid=1510642070
那么亞馬遜的翻頁規則就是:
https://www.amazon.cn/s/ref=sr_pg_2?rh=n%3A664978051%2Cn%3A665002051%2Ck%3A%E6%89%8B%E6%9C%BA&page={{1-10}}&keywords=%E6%89%8B%E6%9C%BA&ie=UTF8&qid=1510642070
7、阿里巴巴物流多頁設置
網址是:
http://56.1688.com/order/price/estimate_price.htm?_fm.es._0.s=310000&_fm.es._0.se=310100&_fm.es._0.sen=&_fm.es._0.r=440000&_fm.es._0.re=440100&_fm.es._0.rec=¬First=true&_fm.es._0.o=&_fm.es._0.c=&_fm.es._0.co=&_fm.es._0.sp=&_fm.es._0.i=&_fm.es._0.is=&_fm.es._0.isf=&_fm.es._0.isp=&_fm.es._0.iscn=&_fm.es._0.isn=&_fm.es._0.isc=&_fm.es._0.isa=&_fm.es._0.ro=&_fm.es._0.w=&_fm.es._0.we=&_fm.es._0.v=&_fm.es._0.vo=&_fm.es._0.tra=&_fm.es._0.tran=&_fm.es._0.isfr=&_fm.es._0.a=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&r=1510642795306&sizePerPage=&pageIndex=2&weight=&expressRouteSortType=&_fm.es._0.sentc=#tab
http://56.1688.com/order/price/estimate_price.htm?_fm.es._0.s=310000&_fm.es._0.se=310100&_fm.es._0.sen=&_fm.es._0.r=440000&_fm.es._0.re=440100&_fm.es._0.rec=¬First=true&_fm.es._0.o=&_fm.es._0.c=&_fm.es._0.co=&_fm.es._0.sp=&_fm.es._0.i=&_fm.es._0.is=&_fm.es._0.isf=&_fm.es._0.isp=&_fm.es._0.iscn=&_fm.es._0.isn=&_fm.es._0.isc=&_fm.es._0.isa=&_fm.es._0.ro=&_fm.es._0.w=&_fm.es._0.we=&_fm.es._0.v=&_fm.es._0.vo=&_fm.es._0.tra=&_fm.es._0.tran=&_fm.es._0.isfr=&_fm.es._0.a=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&r=1510642804940&sizePerPage=&pageIndex=3&weight=&expressRouteSortType=&_fm.es._0.sentc=#tab
http://56.1688.com/order/price/estimate_price.htm?_fm.es._0.s=310000&_fm.es._0.se=310100&_fm.es._0.sen=&_fm.es._0.r=440000&_fm.es._0.re=440100&_fm.es._0.rec=¬First=true&_fm.es._0.o=&_fm.es._0.c=&_fm.es._0.co=&_fm.es._0.sp=&_fm.es._0.i=&_fm.es._0.is=&_fm.es._0.isf=&_fm.es._0.isp=&_fm.es._0.iscn=&_fm.es._0.isn=&_fm.es._0.isc=&_fm.es._0.isa=&_fm.es._0.ro=&_fm.es._0.w=&_fm.es._0.we=&_fm.es._0.v=&_fm.es._0.vo=&_fm.es._0.tra=&_fm.es._0.tran=&_fm.es._0.isfr=&_fm.es._0.a=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&r=1510642804940&sizePerPage=&pageIndex=4&weight=&expressRouteSortType=&_fm.es._0.sentc=#tab
那么阿里巴巴物流的翻頁規則就是:
http://56.1688.com/order/price/estimate_price.htm?_fm.es._0.s=310000&_fm.es._0.se=310100&_fm.es._0.sen=&_fm.es._0.r=440000&_fm.es._0.re=440100&_fm.es._0.rec=¬First=true&_fm.es._0.o=&_fm.es._0.c=&_fm.es._0.co=&_fm.es._0.sp=&_fm.es._0.i=&_fm.es._0.is=&_fm.es._0.isf=&_fm.es._0.isp=&_fm.es._0.iscn=&_fm.es._0.isn=&_fm.es._0.isc=&_fm.es._0.isa=&_fm.es._0.ro=&_fm.es._0.w=&_fm.es._0.we=&_fm.es._0.v=&_fm.es._0.vo=&_fm.es._0.tra=&_fm.es._0.tran=&_fm.es._0.isfr=&_fm.es._0.a=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&_fm.es._0.d=&r=1510642804940&sizePerPage=&pageIndex={{1-10}}&weight=&expressRouteSortType=&_fm.es._0.sentc=#tab
8、豆瓣電影雷神3影評的多頁設置
網址是:
https://movie.douban.com/subject/25821634/comments?start=20&limit=20&sort=new_score&status=P&percent_type=
https://movie.douban.com/subject/25821634/comments?start=40&limit=20&sort=new_score&status=P&percent_type=
https://movie.douban.com/subject/25821634/comments?start=60&limit=20&sort=new_score&status=P&percent_type=
那么豆瓣電影的翻頁規則就是:
https://movie.douban.com/subject/25821634/comments?start={{0-180;20}}&limit=20&sort=new_score&status=P&percent_type=
9、淘寶搜索零食的多頁設置
網址是:
https://s.taobao.com/search?q=%E9%9B%B6%E9%A3%9F&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_20171114&ie=utf8&bcoffset=4&ntoffset=4&p4ppushleft=1%2C48&s=44
https://s.taobao.com/search?q=%E9%9B%B6%E9%A3%9F&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_20171114&ie=utf8&bcoffset=4&ntoffset=4&p4ppushleft=1%2C48&s=88
https://s.taobao.com/search?q=%E9%9B%B6%E9%A3%9F&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_20171114&ie=utf8&bcoffset=4&ntoffset=4&p4ppushleft=1%2C48&s=132
那么淘寶的翻頁規則就是:
https://s.taobao.com/search?q=%E9%9B%B6%E9%A3%9F&imgfile=&js=1&stats_click=search_radio_all%3A1&initiative_id=staobaoz_20171114&ie=utf8&bcoffset=4&ntoffset=4&p4ppushleft=1%2C48&s={{0-396;44}}
10、V2EX程序員類別的多頁設置
網址是:
https://www.v2ex.com/go/programmer?p=2
https://www.v2ex.com/go/programmer?p=3
https://www.v2ex.com/go/programmer?p=4
那么V2EX的翻頁規則就是:
https://www.v2ex.com/go/programmer?p={{1-10}}
11、胡歌所有微博多頁設置
網址是:
https://weibo.cn/hu_ge?page=2
https://weibo.cn/hu_ge?page=3
https://weibo.cn/hu_ge?page=4
那么微博的翻頁規則就是:
https://weibo.cn/hu_ge?page={{1-10}}
12、北京鏈家二手房多頁設置
網址是:
https://bj.lianjia.com/ershoufang/pg2
https://bj.lianjia.com/ershoufang/pg3
https://bj.lianjia.com/ershoufang/pg4
那么鏈家的翻頁規則就是:
https://bj.lianjia.com/ershoufang/pg{{1-10}}