Code Monkey home page Code Monkey logo

Comments (3)

Tiang-88 avatar Tiang-88 commented on September 16, 2024

可以给一个详细的步骤吗?

from yuque-exporter.

markyun avatar markyun commented on September 16, 2024

可以给一个详细的步骤吗?

关键code

for (const object of bookData) {
for (let i = 0; i < object.books.length; i++) {
if (booksId && object.books[i].id ===booksId) {
const book = new Book(object.books[i].id, delNonStdChars(object.books[i].name), object.books[i].slug);
console.log("book",book);
book.root = await getBookDetail(page, book);
book.user_url = object.books[i].user.login
books.push(book);
}

    }
}

from yuque-exporter.

fgc346 avatar fgc346 commented on September 16, 2024

根据知识库名称下载特定知识库的步骤

获取知识库的数据结构

  "id": *********,
  "type": "Book",
  "slug": "isowbw",
  "name": "**********",
  "user_id": *********,
  "description": null,
  "items_count": 1,
  "likes_count": 0,
  "watches_count": 0,
  "creator_id": ********,
  "abilities": {
    "read": true,
    "update": true,
    "modify_setting": true,
    "destroy": true,
    "share": true,
    "read_private": true,
    "create_doc": true
  },

重点关注的字段

  • id 知识库的ID
  • name 知识库的名称

关键代码修改

修改文件的路径

src/toc.js

具体代码修改

因为我的知识库全部改成了英文名称,因此,我使用知识库名称过滤。

    for (const object of bookData) {
       // 定义要导出的知识库名称,
        var book_name = "*****";
       // 也可以根据知识库的id过滤,也是由知识库名称找到对应的知识库ID。
        var book_id = "****";
        for (let i = 0; i < object.books.length; i++) {
            // 筛选出 特定的知识库,根据知识库名字进行过滤
            if (book_name == object.books[i].name)
           // if (book_id == object.books[i].id)
            {
              const book = new Book(object.books[i].id, delNonStdChars(object.books[i].name), object.books[i].slug);
              // console.log(`Books information is: `, JSON.stringify(object.books[i]));
  
              // break;
              // continue;
              book.root = await getBookDetail(page, book);
              book.user_url = object.books[i].user.login
              books.push(book);
            }
        }
    }

效果

当执行 node main.js之后,就只下载特定的知识库。

from yuque-exporter.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.