Created
April 7, 2018 07:46
-
-
Save maple3142/5ad9a790c49d4711d5dea628ba39e2fb to your computer and use it in GitHub Desktop.
取得 https://tieba.baidu.com/p/5626879744?pn=1 101~111 話
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (await Promise.all([1,2,3].map(x=>fetch(`https://tieba.baidu.com/p/5626879744?pn=${x}`).then(r=>r.text())))).filter((x,i)=>parseInt($(x).find('.tP')[0].textContent)===i+1).map(x=>$(x).find('.d_post_content').toArray().reduce((d,x)=>{ | |
| const div=document.createElement('div') | |
| div.innerHTML=x.innerHTML.replace(/<br>/g,'\n').replace(/</g,'<').replace(/>/g,'>') | |
| if(div.textContent.replace(/(\n| )/g,'').length>=50&&!div.textContent.includes('广告')&&!div.textContent.includes('免费'))return d+'\n'+div.textContent | |
| else return d | |
| },'').trim()).join('\n\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment