4chan-full
Version:
www.4chan.org non-official read only api. That supports cool things!
18 lines (12 loc) • 577 B
JavaScript
const { SafetyTypeReverse } = require("../other/SafetyType");
const { PopularThreads } = require("../types/PopularThreads");
const { parsePopularThread } = require("./parsePopularThread");
function parsePopularThreads(e, safety) {
const _popularThreads = new PopularThreads();
_popularThreads.safety = SafetyTypeReverse[safety];
_popularThreads.threads = Array.from(e.querySelectorAll(".c-thread")).map(popularThreadElm => {
return parsePopularThread(popularThreadElm)
});
return _popularThreads;
}
module.exports = { parsePopularThreads };