text: const iconv = require('iconv-lite');
  const got = require('@/utils/got');
  const cheerio = require('cheerio');
  
  module.exports = async(ctx) => {
      const response = await got.get(`http://jyt.hebei.gov.cn/col/${ctx.params.type}/index.html`, {
          responseType: 'buffer',
      });
      const data = iconv.decode(response.data, 'gb2312');
  
      const $ = cheerio.load(data);
      const list = $("div.nr table tbody tr");
      const typeName = $("div.nr span").first().find("a").last().text();
  
      ctx.state.data = {
          title: '河北省教育厅-' + typeName,
          link: 'http://jyt.hebei.gov.cn/',
          item: list &&
              list
              .map((index, item) => {
                  if (index == 0) return;
                  item = $(item);
                  return {
                      title: item.find('a').first().text(),
                      description: '',
                      pubDate: item.find('td').eq(2).text(),
                      link: item.find('a').first().attr('href'),
                  };
              })
              .get(),
      };
  };
  