import cheerio from 'cheerio'; import { doRequest } from './utils/request'; const jsonframe = require('jsonframe-cheerio'); export async function scrapeWithJson(url, json) { try { const html = await doRequest(url); // @ts-ignore const $ = cheerio.load(html); jsonframe($); // @ts-ignore const resp = $('body').scrape(json); return resp; } catch (error: any) { console.error('scrapeWithJson error', error); throw error; } }