Files
RSSHub/lib/v2/qoo-app/notes/user.js
T
Tony 3d1b54f1b4 feat(route): add qoo-app (#11624)
* feat(route): qoo-add

* docs: add docs

* refactor: combine extractNotes
2023-01-15 16:25:20 -01:00

21 lines
543 B
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
const { notesUrl, extractNotes } = require('../utils');
module.exports = async (ctx) => {
const { uid, lang } = ctx.params;
const link = `${notesUrl}${lang ? `/${lang}` : ''}/user/${uid}`;
const { data: response } = await got(link);
const $ = cheerio.load(response);
const items = extractNotes($);
ctx.state.data = {
title: $('head title').text(),
link,
language: $('html').attr('lang'),
item: items,
};
};