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
πŸ“· Instagram Bot - Tool for automated Instagram interactions

InstaPy Tooling that automates your social media interactions to β€œfarm” Likes, Comments, and Followers on Instagram Implemented in Python using the Se

Tim Großmann 13.5k Dec 01, 2021
AWS SDK for Python

Boto3 - The AWS SDK for Python Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, which allows Python developers to wri

the boto project 7.8k Jan 08, 2023
Ethereum Gas Fee for the MacBook Pro touchbar (using BetterTouchTool)

Gasbar Ethereum Gas Fee for the MacBook Pro touchbar (using BetterTouchTool) Worried about Ethereum gas fees? Me too. I'd like to keep an eye on them

TSS 51 Nov 14, 2022
MusicBot is the original Discord music bot written for Python 3.5+, using the discord.py library

The original MusicBot for Discord (formerly SexualRhinoceros/MusicBot)

Just Some Bots 2.9k Jan 02, 2023
Library to manage your own custom RPC on your desktop

Info I don't recommend novices setting this up yourself. It requires Redis, a server to host the API on, and a bit of understanding of Windows & Pytho

Isaac K 1 Apr 16, 2022
`python-jamf` is a library for connecting to a Jamf Server that maps directly to the Jamf Pro Classic API.

`python-jamf` is a library for connecting to a Jamf Server that maps directly to the Jamf Pro Classic API. It is the basis for the `jctl` tool to automate patch management & packages and many other i

University of Utah, Marriott Library, Apple Support 38 Dec 13, 2022
A bot to display per user data from the Twitch Leak

twitch-leak-bot-discord A bot to display per user data from the Twitch Leak by username Where's the data? I can't and don't want to supply the .csv's

SSSEAL-C 0 Nov 08, 2022
Python Markov Chain chatbot running on Telegram

Hanasubot Hanasubot (Japanese θ©±γ™γƒœγƒƒγƒˆ, talking bot) is a Python chatbot running on Telegram. The bot is based on Markov Chains so it can learn your word

12 Dec 27, 2022
Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free)

Azpn-Azure-Free-VPN Azure free vpn for students only! (Self hosted/No sketchy services/Fast and free) This is an alternative secure way of accessing f

Harishankar Kumar 6 Mar 19, 2022
Discord heximals: More colors for your bot

DISCORD-HEXIMALS More colors for your bot ! Support : okimii#0434 COLORS ( 742 )

4 Feb 04, 2022
Unofficial instagram API, give you access to ALL instagram features (like, follow, upload photo and video and etc)! Write on python.

Instagram-API-python Unofficial Instagram API to give you access to ALL Instagram features (like, follow, upload photo and video, etc)! Written in Pyt

Vladimir Bezrukov 1 Nov 19, 2021
Simple Similarities Service

simsity Simsity is a Super Simple Similarities Service[tm]. It's all about building a neighborhood. Literally! This repository contains simple tools t

vincent d warmerdam 95 Dec 25, 2022
Trading through Binance's API using Python & sqlite

pycrypt Automate trading crypto using Python to pull data from Binance's API and analyse trends. May or may not consistently lose money but oh well it

Maxim 4 Sep 02, 2022
Discord group chat leaver.

Discord group chat leaver I know many people who have fallen victim to these weird group chat spammers including me. I made this script to help those

cliphd 3 Feb 27, 2022
A collection of scripts to steal BTC from Lightning Network enabled custodial services. Only for educational purpose! Share your findings only when design flaws are fixed.

Lightning Network Fee Siphoning Attack LN-fee-siphoning is a collection of scripts to subtract BTC from Lightning Network enabled custodial services b

Reckless_Satoshi 14 Oct 15, 2022
A discord bot written in discord.py to manage custom roles assigned to boosters of your server.

BBotty A discord bot written in discord.py to manage custom roles assigned to boosters of your server. v0.0.1-alpha released! This version is incomple

Oui002 1 Nov 27, 2021
A Telegram bot written in python.

telegram_bot This bot is currently a beta project. Features A telegram bot which can: Send current COVID-19 cases/stats of Germany Send current worth

HuhnCares 1 Jan 11, 2022
Django3 web app that renders OpenWeather API data ☁️☁️

nz-weather For a live build, visit - https://brandonru.pythonanywhere.com/ NZ Openweather API data rendered using Django3 and requests β˜€οΈ Local Run In

Brandon Ru 1 Oct 17, 2021
A robust, low-level connector for the Discord API

Bauxite Bauxite is a robust, low-level connector for the Discord API. What is Bauxite for? Bauxite is made for two main purposes: Creating higher-leve

1 Dec 04, 2021
π—–π π¦π©π πžπ₯ 𝝦π—₯πžπ—–π½Β°β„’οΈ πŸ‡±πŸ‡° Is An All In One Media Inline Bot Made For Inline Your Media Effectively With Some Advance Security Toolsβ™₯️

π—–π π¦π©π πžπ₯ 𝝦π—₯πžπ—–π½Β° ℒ️ πŸ‡±πŸ‡° π—™π—˜π π©π—¨π—₯π—˜π—¦ Auto Filter IMDB Admin Commands Broadcast Index IMDB Search Inline Search Random Pics Ids & User I

KΙͺκœ±α΄€Κ€α΄€ Pα΄‡κœ±α΄€Ι΄α΄ŠΙͺα΄›Κœ Pᴇʀᴇʀᴀ 〄 13 Jun 21, 2022