Skip to content

Xmind的思维导图更新 #5568

@skycloudly

Description

@skycloudly

希望增加Xmind的思维导图分享更新

网站地址

https://www.xmind.net/share/?category=zh

网站描述

Xmind的思维导图在线分享

需要生成什么内容?

Xmind的思维导图分享更新

额外描述

写了一段代码,但是提示类型错误。。。不知道是哪里的错?
``
const got = require('@/utils/got');
const cheerio = require('cheerio');

module.exports = async (ctx) => {
const response = await got({ // 发起 HTTP GET 请求
method: 'get',
url: 'https://www.xmind.net/share/?category=zh',
});

const data = response.data;  // response.data 为 HTTP GET 请求返回的 HTML,也就是简书首页的所有 HTML

const $ = cheerio.load(data);  // 使用 cheerio 加载返回的 HTML
const listtmp = $('div[data-next="7j2B-1554775679000"]');
let list = listtmp[0];

let itemPicUrl;

ctx.state.data = {
    title: 'Mindmap Gallery - XMind - Mind Mapping Software',
    link: 'https://www.xmind.net/share/?category=zh',
    item:
        list &&
        list
            .map((index, item) => {  //使用 map 遍历数组,解析出每一个 item 的结果
                item = $(item);
                itemPicUrl = `${item.find('div.share-gallery > div:nth-child(1) > a > div > img').attr('src')}`;
                return {
                    title: item
                        .find('div[1] > div > a')
                        .text(),
                    link: 'https://www.xmind.net/' + item.find('div > a').attr('href'),
                };
            })
            .get(),
};

};

``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions