Coder Social home page Coder Social logo

notion-pdf-exporter's Introduction

notion-pdf-exporter

This is a little workaround to automate the export of multiple URLs from Notion using puppeteer.js to emulate a user's navigation.

How to use

Before starting to use this project, like every workaround created in a few hours, there is an effort to configure the Notion authentication token, the other cookies and map the URLs to be exported.

Git clone

Run in terminal:

  • git clone [email protected]:jefferson-amorim/notion-pdf-exporter.git
  • cd ./notion-pdf-exporter
  • npm i

Configure the .env file

Notion's authentication token can be captured in cookies from any https://notion.so screen after a user is logged in.

The name of the cookie is "token_v2" and you will not have access through document.cookie, only through the devtools of a browser like Chrome.

  • Open devtools, find the page cookies and search for "token_v2".
  • Copy the cookie value;
  • Create the .env file based on the .env-sample;
  • Change token value to copied cookie value;
  • Save this file.

Configure the .notion-cookies

Assuming you're still logged in and have devtools open:

  • Open the devtools console;
  • Execute copy(document.cookie) to copy cookies content to clipboard;
  • Create the .notion-cookies file based on the .notion-cookies-sample;
  • Paste the contents of the clipboard to the file;
  • Save this file.

Configure the .notion-urls

It's not all roses and you need to list the Notion URLs you want to export to PDF. The good news is that you can only list the parent URLs, as this project exports pages and subpages.

  • Create the .notion-urls file based on the .notion-urls-sample;
  • List all parent URLs, one per line;
  • Save this file.

Run it!

Run npm start in the terminal and wait for the magic to happen.

After the "end of export" message in the terminal, the .zip files will be in the project's /downloads directory.

notion-pdf-exporter's People

Contributors

jefferson-amorim avatar

Watchers

 avatar

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.