项目作者: jasonleyser

项目描述 :
A NodeJS script to add an eBook from Project Gutenburg to Slate.
高级语言: JavaScript
项目地址: git://github.com/jasonleyser/project-gutenberg-importer.git
创建时间: 2021-03-19T01:36:49Z
项目社区:https://github.com/jasonleyser/project-gutenberg-importer

开源协议:MIT License

下载


project-gutenberg-slate-importer

A NodeJS script to add an eBook from Project Gutenburg to Slate.

The script uses one of the Project Gutenburg mirrors to retrieve an eBook’s HTML file.

  1. eBook ID to fetch the file in the mirror’s directory structure.

    For example, eBook #12345 is stored under 1/2/3/4/12345-h/12345-h.htm

  2. HTML eBook is converted to PDF using the Microlink API

  3. PDF is uploaded to Slate
  4. The book’s title, description, author and original source is updated on Slate

Setting up the Cronjob

  1. Fork or clone this repo
  2. Create a new Cron Job on render.com, and deploy this repo
  3. In the settings, make sure these fields are set to:

    Build command: npm install

    Command: npm run start

    Screen Shot 2021-03-19 at 9 18 55 AM

  4. Set the schedule time to how often you want the script to run.


    For example:

    */5 * * * * will run every 5 minutes

    0 0 8 1/1 * ? * will run once a day at 8:00am

  5. Create two ENV variables called:
    API_KEY
    SLATE_ID

    Go to slate.host to create/retrieve your API key and Slate ID.

Using locally

  1. Fork or clone this repo
  2. Create a .env file in the new project folder and add:

    API_KEY=YOUR_SLATE_API_KEY

    SLATE_ID=YOUR_SLATE_ID
  3. In Terminal, navigate to the project folder and run

    npm import.js