csdn目錄的分頁:
後面是幾就是幾個分頁,簡單點,直接遍歷增加就好了,
導包就不細說了:
!-- 解析html --
>
org.jsoup<
/groupid>
jsoup<
/artifactid>
1.11
.3<
/version>
<
/dependency>
fr.opensagres.xdocreport<
/groupid>
fr.opensagres.xdocreport.converter.docx.xwpf<
/artifactid>
2.0.1
<
/version>
<
/dependency>
<
!-- 阿里json解析器 --
;}工具類方法,httputil的乙個,和流轉字串的乙個
public
static inputstream doget
(string urlstr, map
headers)
throws ioexception
} random random =
newrandom()
; string ip =
(random.
nextint
(100)+
100)
+"."
+(random.
nextint
(100)+
100)
+"."
+(random.
nextint
(100)+
100)
+"."
+(random.
nextint
(100)+
100)
; conn.
setrequestproperty
("x-forwarded-for"
, ip)
; inputstream inputstream = conn.
getinputstream()
;return inputstream;
}public
static string inputstreamtostring
(inputstream is, string charset)
throws ioexception
return sb.
tostring()
;}
爬取結果:
然後直接考到csdn寫文章裡面去就可以了:
爬取自己的csdn訪問排名資訊
爬取自己部落格的訪問量,積分,排名的資訊 學python不久,前乙個月看見了一篇爬取csdn的文章,一直想自己試試,今天總算完成了乙個比較low的版本了吧 from requests import import os import time from bs4 import beautifulsoup...
爬蟲抓取自己csdn部落格點讚數
檢視自己文章的點讚數 瀏覽量。import requests,re,math url r requests.get url,headers text articles re.search d s 原創 r group 1 pages int math.ceil int articles 20 art...
爬蟲入門(一)爬自己的CSDN部落格
今天本來在搞人體識別模型的,emmm後來想搞一直想試的爬蟲,於是我就來了!我是用的軟體是pycharm,這個軟體是jetbrains開發的,我最近使用的連線資料庫的軟體datagrip也是jetbrains公司了,只不過我認為datagrip對新使用者不太友好,很多功能都隱藏起來了,還要你自己去發現...