How to Use Zhihu Picture Web-crawler

1. Give the question ID in Zhihu (such as https://www.zhihu.com/question/27741971   here, question ID is 27741971);
2. Give the number of pages you want to get in this question, then this programming will get answers in these pages and download pictures in answers;
3. Give the save address that you want to save pictures (for Windows system, such as “C://Users//Pictures//wallpaper”);
4. Fill the first commend line using the information above, then run it;
5. Run the second part programming.

Important things you should notice!!!
1. This programming is created for studying relative string knowledge in Mathematica, you must not use this programming for illegal things!!!
2. To avoid your IP was prohibited by Zhihu, the speed of programming has slowed down (one action per second).
3. Because the shortcoming of programming, this programming can only get 75 percents of all answers.

Programming

questionid="27741971";
maxpage=3;
saveaddress="C://Users//Pictures//wallpaper";

pagenumstring=Table[ToString[i],{i,1,maxpage,0.5}];
pagehot=Table[0,{i,1,Length[pagenumstring]}];
pageupdated=Table[0,{i,1,Length[pagenumstring]}];
For[hotno=1,hotno<Length[pagenumstring]+1,hotno++,Pause[1];pagehot[[hotno]]=Import["https://www.zhihu.com/question/"<>questionid<>"?page="<>pagenumstring[[hotno]],"Text"]];
For[upno=1,upno<Length[pagenumstring]+1,upno++,Pause[1];pageupdated[[upno]]=Import["https://www.zhihu.com/question/"<>questionid<>"/answers/updated?page="<>pagenumstring[[upno]],"Text"]];
answeridstringhot=Flatten[Table[StringSplit[StringDrop[StringDrop[StringSplit[StringSplit[pagehot[[i]],"newIds"][[-2]],"ids"][[-1]],3],-3],","],{i,1,Length[pagenumstring]}]]//Union;
answeridstringupdated=Flatten[Table[StringSplit[StringDelete[StringDelete[StringDrop[StringDrop[StringSplit[StringSplit[pageupdated[[i]],"totals"][[-2]],"ids"][[-1]],3],-3],",null"],"null,"],","],{i,1,Length[pagenumstring]}]]//Union//Drop[#,-1]&;
answeridstring=Union[answeridstringhot,answeridstringupdated];
StringForm["The number of answer you get is ``",Length[answeridstring]]
answerlist=Table[0,{i,1,Length[answeridstring]}];
For[ansno=1,ansno<Length[answeridstring]+1,ansno++,Pause[1];answerlist[[ansno]]=Import["https://www.zhihu.com/question/"<>questionid<>"/answer/"<>answeridstring[[ansno]]<>"/","XMLObject"]];
address=Cases[answerlist,XMLElement["noscript",{},{XMLElement["span",{"class"->"RichText ztext CopyrightRichText-richText","itemprop"->"text"},{XMLElement["img",{___,"src"->src_,___},{}]}]}]:>src,{0,Infinity}];
rawaddress=StringReplace[address,"_hd"->"_r"];
postfix=StringTake[#,-3]&/@rawaddress;
StringForm["The number of picture you get is ``",Length[rawaddress]]
name=Table[StringForm[saveaddress<>"//``.``",i,postfix[[i]]],{i,1,Length[rawaddress]}];
For[picno=1,picno<Length[rawaddress]+1,picno++,Pause[1];Export[ToString[name[[picno]]],Import[rawaddress[[picno]]]]];

Dynamic[{picno,ansno,upno,hotno}]