
本文首发于 CNodejs.org https://cnodejs.org/topic/576e0babd3baaf401780bb5f
------------------- 原文--------------------
RT. 就是下一页, 下一页这种...给抽象了一下... 这里有个抓取 V2EX 的栗子 https://github.com/magicdawn/next-page-kit/blob/v0.0.1/test/simple.js#L16 提供本页要干啥, 是否有下一页, 下一页地址... 最后得到一个结果...就是这样
下面是 README ---------------------------------我是分割线-----------------------------
Helper for handle next-next page
npm i next-page-kit -S const NextPage = require('next-page-kit'); n = new NextPageinit/postInit : hook function. return a promise is also supportedaction/hasNext/getNext: the logicconst n = new NextPage({ init() { }, postInit() { }, action($) { }, hasNext($) { }, getNext($) { } }); yield n.run() n.runn.run(url, options) url: the entryoptions: enc: the html encodinglimit: page limitthe MIT License http://magicdawn.mit-license.org