ditzzsenpai-api
Version:
Simple NPM api for your app
27 lines (20 loc) • 717 B
JavaScript
const cheerio = require("cheerio");
const axios = require("axios");
host = "https://happymod.com";
async function hwhw(q) {
html = (await axios.get(`${host}/search.html?q=${q}`)).data;
let $ = cheerio.load(html);
tez = $(
"body > div.container-row.clearfix.container-wrap > div.container-left > section > div.pdt-app-box"
);
if (!tez.toString()) throw { status: 404, result: [] };
res = [];
tez.each(function (g, o) {
link = host + $(o).find("a").attr("href");
title = $(o).find("a").attr("title");
thumb = $(o).find("img").attr("data-original");
res.push({ title, link, thumb });
});
return { status: 200, creator: "Ditzzy", result: res };
}
module.exports = hwhw.bind();