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 simple test repo created following docker docs.

docker_sampleRepo A simple test repo created following docker docs. Link to docs: https://docs.docker.com/language/python/develop/ Other links: https:

Suraj Verma 2 Sep 16, 2022
an OSU! bot sdk based on IRC

osu-bot-sdk an OSU! bot sdk based on IRC Start! The following is an example of event triggering import osu_irc_sdk from osu_irc_sdk import models bot

chinosk 2 Dec 16, 2021
um simples script para localizar IP

um simples script para localizar IP pkg install git (apt-get install git) pkg install python (apt-get install python) git clone https://github.com/byd

bydeathlxncer 4 Nov 29, 2021
A template that help you getting started with Pycord.

A Pycord Template with some example! Getting Started: Clone this repository using git clone https://github.com/AungS8430/pycord-template.git If you ha

2 Feb 10, 2022
Generates a coverage badge using coverage.py and the shields.io service.

Welcome to README Coverage Badger 👋 Generates a coverage badge using coverage.py and the shields.io service. Your README file is then updated with th

Victor Miti 10 Dec 06, 2022
Slack->DynamDB->Some applications

slack-event-subscriptions About The Project Do you want to get simple attendance checks? If you are using Slack, participants can just react on a spec

UpstageAI 26 May 28, 2022
A fork of discord.py meant to replace it

Texus A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. Key Features Modern Pythonic API using async and

Texus 1 Nov 18, 2021
This bot can mention members upto 10,000 in groups and can mention members upto 200 in channels !

Mention All Bot This bot can mention members upto 10,000 in groups and can mention members upto 200 in channels ! 🏷 Infomation Language: Python. Tele

Anjana Madu 52 Dec 29, 2022
A liblary whre you can find helpful functions for your discord bot

DBotUtils A liblary whre you can find helpful functions for your discord bot Easy setup Setup is easily and flexible. Change anytime. After setup just

Kondek286 1 Nov 02, 2021
ignorant allows you to check if a phone number is used on different sites like snapchat, instagram.

Ignorant For BTC Donations : 1FHDM49QfZX6pJmhjLE5tB2K6CaTLMZpXZ ignorant does not alert the target phone number ignorant allows you to check if a phon

Palenath 513 Dec 31, 2022
Revolt.py - An async library to interact with the https://revolt.chat api.

Revolt.py An async library to interact with the https://revolt.chat api. This library will be focused on making bots and i will not implement anything

Zomatree 0 Oct 08, 2022
Poll-Bot Repo For Telegram #telegram

Intro This Is A Simple Bot To Create Poll In Channel and Groups And Also This Is our First Project Too.. Enter you tokens at these are very important

BotsUniverse 6 Oct 21, 2022
Chronocalc - Calculates the dates and times when the sun or moon is in a given position in the sky

Chronocalc I wrote this script after I was busy updating my article on chronoloc

16 Dec 13, 2022
Asyncio SDK for Azure Cosmos DB

Asyncio SDK for Azure Cosmos DB. This library is intended to be a very thin asyncio wrapper around the Azure Comsos DB Rest API. It is not intended to have feature parity with the Microsoft Azure SDK

Grant McDonald 4 Dec 04, 2021
Replacement for the default Dark Sky Home Assistant integration using Pirate Weather

Pirate Weather Integrations This integration is designed to replace the default Dark Sky integration in Home Assistant with a slightly modified, but f

Alexander Rey 129 Jan 06, 2023
Python SDK for interacting with the Frame.io API.

python-frameio-client Frame.io Frame.io is a cloud-based collaboration hub that allows video professionals to share files, comment on clips real-time,

Frame.io 37 Dec 21, 2022
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022
Semplice pagina di informazione per sapere se e quando è uscito Joypad, il podcast a tema videoludico di Matteo Bordone (Corri!), Francesco Fossetti (Salta!) e Alessandro Zampini (Spara! per finta).

È uscito Joypad? Semplice pagina di informazione per sapere se e quando è uscito Joypad, il podcast a tema videoludico di Matteo Bordone (Corri!), Fra

Paolo Donadeo 32 Jan 02, 2023
自用直播源集合,附带检测与分类功能。

myiptv 自用直播源集合,附带检测与分类功能。 为啥搞 TLDR: 太闲了。 自己有收集直播源的爱好,和录制直播源的需求。 一些软件自带的直播源太过难用。 网上现有的直播源太杂,且缺乏检测。 一些大源缺乏持续更新,如 iptv-org。 使用指南与 TODO 每次进行大更新后都会进行一次 rel

abc1763613206 171 Dec 11, 2022
SMAM2 is a package manager built specifically for SourceMod.

SourceMod Addon Manager 2 (SMAM2) SMAM2 is a package manager built specifically for SourceMod. This was heavily inspired by Phil25's SMAM. I thought t

John Mascagni 6 Sep 16, 2022