Notion4ever - Python tool for export all your content of Notion page using official Notion API

Overview

NOTION4EVER

Notion4ever is a small python tool that allows you to free your content and export it as a collection of markdown and HTML files via the official Notion API.

✨ Features

  • Export ready to deploy static HTML pages from your Notion.so pages. root_page

  • Supports nice urls.

  • Downloads all your Notion content, which is accessible via API to a raw JSON file.

  • Uses official Notion API (via notion-sdk-py, but you can use curls if you want).

  • Supports arbitrary page hierarchy. breadcrumb

  • Supports galleries and lists gallery

    list

    Note that Notion API does not provide information about the database view yet. That is why notion4ever will render the database as a list if any database entries do not have a cover. Suppose all entries have covers, then it will be displayed as a gallery.

  • Lightweight and responsive.

  • Downloads all your images and files locally (you can turn this off if you prefer to store images\files somewhere else).

πŸ’» How to run it locally

Just copy or clone the content of this repository and run.

python -m notion4ever -n NOTION_TOKEN -p NOTION_PAGE_ID -bl True

πŸ€– How to run it automatically with Github actions

I will demonstrate it on the specific example of my site. Notion page -> Github repository Congratulations πŸ€— !

βœ… Step 1. Create/choose some page in Notion.

  1. We will need the page ID. For example, the page with URL https://fmin.notion.site/Danya-Merkulov-12e3d1659a444678b4e2b6a989a3c625 has the following ID: 12e3d1659a444678b4e2b6a989a3c625.

  2. Also, we will need to create a Notion API token. Go to Notion.so/my-integrations -> Create new integration. Type the name of the integration and press submit. Now you can see your token, which starts with secret_*** under the Internal Integration Token field.

βœ… Step 2. Set up a repository for your static site.

In my case, it is github.com/MerkulovDaniil/merkulovdaniil.github.io/.

  1. You need to specify your Notion settings in a Github action secret. Jump to the Settings -> Secrets -> Actions -> New repository secret and create two secrets: a. NOTION_PAGE_ID b. NOTION_TOKEN

    github_secret

  2. Create and configure the following GitHub action in your repository:

publish.yml
name: Deploy from Notion to Pages

# on: [workflow_dispatch]
on:
  schedule:
    - cron: "0 */12 * * *" 
    
jobs:
  download_old-generate-push:
    runs-on: ubuntu-latest
    
    steps:
        # Download packages
      - name: Submodule Update
        run: |
          wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
          sudo apt install ./google-chrome-stable_current_amd64.deb
          sudo apt-get update
          
      - name: Set up Python
        uses: actions/[email protected]
        with:
          python-version: 3.10.0
          
      - name: Download notion4ever
        uses: actions/[email protected]
        with:
          repository: 'MerkulovDaniil/notion4ever'
          
      - name: Install packages
        run: pip install -r requirements.txt
        
      - name: Download current version of the site
        uses: actions/[email protected]
        with:
          # HERE, YOU NEED TO PLACE YOUR REPOSITORY
          repository: 'MerkulovDaniil/merkulovdaniil.github.io'
          # TARGET BRANCH
          ref: main
          # THE FOLDER, WHERE NOTION4EVER EXPORTS YOUR CONTENT BY DEFAULT
          path: _site
          
      - name: Run notion4ever
        run: python -m notion4ever
        env:
            # HERE YOU NEED TO PLACE URL OF THE ROOT PAGE. PROBABLY IT IS "https://<username>.github.io"
            SITE_URL: "https://merkulov.top"
            NOTION_TOKEN: ${{secrets.NOTION_TOKEN}}
            NOTION_PAGE_ID: ${{secrets.NOTION_PAGE_ID}}
      
      - name: Deploy to Pages
        uses: JamesIves/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: main
          FOLDER: _site
          COMMIT_MESSAGE: πŸ€– Deployed via notion4ever.

This script will run every 12 hours, and you can change it. Note that the first run could be slow if your page contains a lot of content, but all the subsequent runs will not download existing files. Congratulations πŸ€— !

πŸ›  How it works

  1. Given your notion token and ID of some page, notion4ever downloads all your content from this page and all nested subpages and saves it in a JSON file, notion_content.json.
  2. Given your raw Notion data, notion4ever structures the page's content and generates file notion_structured.json with markdown content of all pages and relations between them. Markdown parsing is done via modification of notion2md library.
  3. Given structured notion content, notion4ever generates site from jinja templates located in ./_templates directory. All styles are located in ./_sass directory and compiled with libsass-python library. By default, site is located in ./_site directory

🌈 Alternatives

πŸ†“ Free

  • loconotion - Python tool to turn Notion.so pages into lightweight, customizable static websites.
  • NotoCourse - properly configured github actions + structuring for loconotion.
  • notablog - blog-oriented static site generator from Notion database.
  • popsy.co - turns your Notion docs into a site with custom domain.

πŸ’° Paid

  • helpkit.so - turns your Notion docs into a hosted self-service knowledge base.
  • float.so - turns your docs in Notion into online course.
  • super.so - turns your Notion docs into a site.
  • potion.so - turns your Notion docs into a site.

πŸ¦„ Examples

Please, add your sites here if you are using Notion4ever.

Notion public page Notion4ever web page
My personal page My personal page

ToDo

  • Proper documentation.
  • Create pip package.
  • Add parralel files downloading.
  • Add search field.
Owner
PhD [email protected], IT, Russia merkulov.top
❀️A next gen powerful telegram group manager bot for manage your groups and have fun with other cool modules

Natsuki Based on Python Telegram Bot Contributors Video Tutorial: Complete guide on deploying @TheNatsukiBot's clone on Heroku. β˜† Video by Sadew Jayas

Pawan Theekshana 8 Oct 06, 2022
A template that everyone can use for the start of their discord bot

Python Discord Bot Template This repository is a template that everyone can use for the start of their discord bot. When I first started creating my d

2 Nov 01, 2021
Mailjet API implementation in Python

READ THIS FIRST!! This repository isn't compatible with the current Mailjet API (v3) and, as a consequence, is considered deprecated and won't undergo

Rick van Hattem 18 Oct 21, 2022
RepositΓ³rio para a Live Coding do dia 22/12/2021 sobre AWS Step Functions

DIO Live Step Functions - 22/12/2021 Serviços AWS utilizados AWS Step Functions AWS Lambda Amazon S3 Amazon Rekognition Amazon DynamoDB Amazon Cloudwa

Cassiano Ricardo de Oliveira Peres 5 Mar 01, 2022
Simple Reddit bot that replies to comments containing a certain word.

reddit-replier-bot Small comment reply bot based on PRAW. This script will scan the comments of a subreddit as they come in and look for a trigger wor

Kefendy 0 Jun 04, 2022
Jira-cache - Jira cache with python

Direct queries to Jira have two issues: they are sloooooow many queries are impo

John Scott 6 Oct 08, 2022
An API or getting Optifine VersionsList/Version/Download-URL.

Optifine-API An API for getting Optifine VersionsList/Versions/Download-URL. Table of contents Get Versions List Get Specify Versions Download Optifin

2 Dec 04, 2022
BoostIRC - IRC Bot which posts boosts to IRC

BoostIRC Quick Start git clone https://github.com/valcanobacon/BoostIRC.git cd B

7 Dec 23, 2022
Aria & Qbittorent Mirror Bot

Eunha Mirror Eunha Mirror is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. Features su

ovin 158 Dec 19, 2022
A user reconnaisance tool that extracts a target's information from Instagram, DockerHub & Github.

A user reconnaisance tool that extracts a target's information from Instagram, DockerHub & Github. Also searches for matching usernames on Github.

Richard Mwewa 127 Dec 22, 2022
GitHub Activity Generator - A script that helps you instantly generate a beautiful GitHub Contributions Graph for the last year.

GitHub Activity Generator A script that helps you instantly generate a beautiful GitHub Contributions Graph for the last year. Before 😐 😢 πŸ˜’ After ?

1 Dec 30, 2021
A simple Python app to provide RPC for iTunes and the Music app. MacOS exclusive.

Ongaku You know, ongaku. A port of Ongaku to Python. Why? I don't know. A simple application providing the now playing state from iTunes (or the Music

Deltaion Lee 4 Oct 22, 2022
A replacement for Reddit /r/copypasta CummyBot2000 with extra measures to avoid it being banned.

CummyBot1984 A replacement for Reddit /r/copypasta's CummyBot2000 with extra measures to respect Reddit's API rules. Features Copies and replies to ev

2 Feb 21, 2022
An attendance bot that joins google meet automatically according to schedule and marks present in the google meet.

Google-meet-self-attendance-bot An attendance bot which joins google meet automatically according to schedule and marks present in the google meet. I

Sarvesh Wadi 12 Sep 20, 2022
Seems Like Everyone Is Posting This, Thought I Should Too, Tokens Get Locked Upon Creation And Im Not Going To Fix For Several Reasons

Member-Booster Seems Like Everyone Is Posting This, Thought I Should Too, Tokens Get Locked Upon Creation And Im Not Going To Fix For Several Reasons

Mintyz 1 Dec 28, 2021
Telegram bot to stream videos in telegram voicechat for both groups and channels.

Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live streams, YouTube videos and telegram media. With record stream support, Schedule streams, and many more

SOCIAL MECHANIC 4 Nov 13, 2022
Univerity-student oriented (lithuanian) discord bot

Univerity-student oriented (lithuanian) discord bot

3 Nov 30, 2021
Telegram bot for searching videos in your PDisk account by @AbirHasan2005

PDisk-Videos-Search A Telegram bot for searching videos in your PDisk account by @AbirHasan2005. Configs API_ID - Get from @TeleORG_Bot API_HASH - Get

Abir Hasan 39 Oct 21, 2022
This project is a basic login system in terminal for Discord

Welcome to Discord Login System(Terminal) πŸ‘‹ This project is a basic login system in terminal for Discord Author πŸ‘€ arukovic Github: @SONIC-CODEZ Show

SONIC-CODEZ 2 Feb 11, 2022
Search all history of Chrome in terminal

Chrotry Search all history of Chrome in terminal. Demo Usages Move the Chrome history file to current directory by running move_history.sh Rename hist

Xiaoxu HU 2 Jun 13, 2022