const got = require('@/utils/got'); const cheerio = require('cheerio'); const iconv = require('iconv-lite'); module.exports = async (ctx) => { const rootUrl = 'http://hk.hkcd.com'; const currentUrl = `${rootUrl}/pdf/index.htm`; const response = await got({ method: 'get', url: currentUrl, responseType: 'buffer', }); const data = iconv.decode(response.data, 'gb2312'); const date = data.match(/