Douban book model for next.
yarn add @jswork/next-model-douban-book
import cheerio from "cheerio";
import "@jswork/next-model-douban-book";
fetch("https://book.douban.com/subject/25941890/")
.then((res) => res.text())
.then((res) => {
var $ = cheerio.load(res, { decodeEntities: false });
var model = new nx.ModelDoubanBook({ $ });
var res = model.gets();
console.log("res: ", res);
expect(res.title).toBe("海伯利安");
});
Code released under the MIT license.