Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const cheerio = require("cheerio")
- const axios = require("axios")
- async function thdown(url) {
- const { data: html } = await axios.get(url);
- const $ = cheerio.load(html);
- const title = $('head > title').text().trim();
- const description = $('div.descricao').text().trim();
- const gallery = [];
- $('div.post_imgs .miniaturas a').each((i, elem) => {
- const href = $(elem).attr('href');
- const imgSrc = $(elem).find('picture img').attr('src');
- const altText = $(elem).find('picture img').attr('alt');
- gallery.push({
- href: 'https://en.thehentai.net' + href,
- imgSrc: 'https://en.thehentai.net' + imgSrc,
- alt: altText
- });
- })
- return {
- title,
- description,
- gallery
- }
- }
- //use
- const ttk = await thdown("https://en.thehentai.net/marin-kitagawa/")
- console.log(JSON.stringify(ttk, null, 2));
Advertisement