Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //For use in Processing 3: https://processing.org
- //int ficID=5193644;//Time Braid
- //int chapterCount=31;
- int ficID=12097887;
- int chapterCount=19;
- String chapters[]=new String[chapterCount];
- String thisChapter[]=new String[1];
- int chapter,secondsToWait=5;
- void setup(){
- noLoop();
- }
- void draw(){
- for(chapter=1;chapter<=chapterCount;chapter++){
- chapters[chapter-1]=join(loadStrings("https://www.fanfiction.net/s/"+ficID+"/"+chapter+"/")," ");//FanFiction.net
- //chapters[chapter-1]=join(loadStrings("https://www.fictionpress.com/s/"+ficID+"/"+chapter+"/")," ");//FictionPress.com
- chapters[chapter-1]=chapters[chapter-1].substring(chapters[chapter-1].indexOf("'storytext'>")+12);//Remove extraneous stuff before chapter text
- chapters[chapter-1]="<h2>"+chapter+"</h2>"+chapters[chapter-1].substring(0,chapters[chapter-1].indexOf("</div>"));//Remove extraneous stuff after chapter text, and add preliminary chapter headings
- thisChapter[0]=chapters[chapter-1];
- saveStrings("output/"+chapter+".html",thisChapter);
- println("Chapter "+chapter+" of "+chapterCount+" obtained...");
- if(chapter<chapterCount){
- delay(secondsToWait*1000);//Avoid overloading servers and getting banned
- }
- }
- if(chapterCount>1){
- saveStrings("output/0.html",chapters);
- }
- println("Done!");
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment