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
LOL-banner - A discord bot that bans anybody playing league of legends

LOL-banner A discord bot that bans anybody playing league of legends This bot ha

bsd_witch 46 Dec 17, 2022
Simple Telegram Bot to Download and Upload Files From Mega.nz

Mega.nz-Bot Simple Telegram Bot to Download Files From Mega.nz and Upload It to Telegram Features All Mega.nz File Links supported No login required A

I'm Not A Bot #Left_TG 245 Jan 01, 2023
This is a Telegram video compress bot repo. By Binary Tech๐Ÿ’ซ

This is a Telegram Video Compress Bot. Prouduct By Binary Tech ๐Ÿ’ซ Features Compresse videos and generate screenshots too.You can set custom video name

silentz lk 7 Mar 03, 2022
Latest Open Source Code for Playing Music in Telegram Video Chat. Made with Pyrogram and Pytgcalls ๐Ÿ’–

MusicPlayer_TG Latest Open Source Code for Playing Music in Telegram Video Chat. Made with Pyrogram and Pytgcalls ๐Ÿ’– Requirements ๐Ÿ“ FFmpeg NodeJS nod

Abhijith Sudhakaran 2 Feb 04, 2022
Python wrapper to simplify calls to AncestryDNA API.

AncestryDNA API wrapper Ancestry exposes an undocumented REST API for its DNA features. This Python wrapper inventories the available calls, and expos

Matt 2 Jun 10, 2022
A Telegram Most Powerful Media Info Bot.

Media Info Bot Support ๐Ÿš‘ Demo For The Bot -Test Our Bot By Clicking The Button Below Deploy To Heroku ๐Ÿ—ณ Press the Deploy Button to Get Your Own Bot.

Anonymous 5 May 16, 2022
This tool is created by Shahzain and is one of the best self bots out there!

Shahzain SelfBot This tool is created by Shahzain and is one of the best self bots out there! Features Token Destroyer! Server Nuker(50-100 Bans Per S

Shahzain 6 Apr 02, 2022
NewpaperNews-API - Json data of the news with python

NewsAPI API Documentation BASE_URL = "https://saurav.tech/NewsAPI/" top_headline

Aryaman Prakash 2 Sep 23, 2022
Versatile async-friendly library to retry failed operations with configurable backoff strategies

riprova riprova (meaning retry in Italian) is a small, general-purpose and versatile Python library that provides retry mechanisms with multiple backo

Tom 108 Apr 27, 2022
This repo provides the source code for "Cross-Domain Adaptive Teacher for Object Detection".

Cross-Domain Adaptive Teacher for Object Detection This is the PyTorch implementation of our paper: Cross-Domain Adaptive Teacher for Object Detection

Meta Research 91 Dec 12, 2022
Evernote SDK for Python

Evernote SDK for Python Evernote API version 1.28 This SDK is intended for use with Python 2.X For Evernote's beta Python 3 SDK see https://github.com

Evernote 612 Dec 30, 2022
A light wrapper around FedEx's SOAP API.

Python FedEx SOAP API Module Author: Greg Taylor, Radek Wojcik Maintainer: Python FedEx Developers License: BSD Status: Stable What is it? A light wra

155 Dec 16, 2022
HackZ-Token-Grabber-V2 - HackZ Token Grabber V2

HackZ-Token-Grabber-V2 was made by Love โŒ code โœ… โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž โ€Ž ๐ŸŒŸ

! โ„ขNightMare 2 Mar 01, 2022
Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python

Autodrive Autodrive is designed to make it as easy as possible to interact with the Google Drive and Sheets APIs via Python. It is especially designed

Chris Larabee 1 Oct 02, 2021
Official python API for Phish.AI public and private API to detect zero-day phishing websites

phish-ai-api Summary Official python API for Phish.AI public and private API to detect zero-day phishing websites How it Works (TLDR) Essentially we h

Phish.AI 168 May 17, 2022
Console BeautifulDiscord theme manager

BeautifulDiscord theme manager Console script for downloading & managing Discord .css themes via BeautifulDiscord. Setup Simply run # Linux/MacOS pip3

1 Dec 15, 2022
Moderation By Pokemon Bot (Discord)

Moderation Bot By Pokรฉmon Bot (Discord) Official Moderation Bot for Pokemon Bot functional and based in the Discord Server, the bot is written in Pyth

Aakash Manoj Agrawal 6 Jan 04, 2022
Checks instagram names to see if they're available

How to install You must have python 3.7.6 installed and make sure you click the 'ADD TO PATH' option when installing Open cmd and type pip install aio

2 Oct 20, 2021
่‡ช็”จ็›ดๆ’ญๆบ้›†ๅˆ๏ผŒ้™„ๅธฆๆฃ€ๆต‹ไธŽๅˆ†็ฑปๅŠŸ่ƒฝใ€‚

myiptv ่‡ช็”จ็›ดๆ’ญๆบ้›†ๅˆ๏ผŒ้™„ๅธฆๆฃ€ๆต‹ไธŽๅˆ†็ฑปๅŠŸ่ƒฝใ€‚ ไธบๅ•ฅๆž TLDR: ๅคช้—ฒไบ†ใ€‚ ่‡ชๅทฑๆœ‰ๆ”ถ้›†็›ดๆ’ญๆบ็š„็ˆฑๅฅฝ๏ผŒๅ’Œๅฝ•ๅˆถ็›ดๆ’ญๆบ็š„้œ€ๆฑ‚ใ€‚ ไธ€ไบ›่ฝฏไปถ่‡ชๅธฆ็š„็›ดๆ’ญๆบๅคช่ฟ‡้šพ็”จใ€‚ ็ฝ‘ไธŠ็Žฐๆœ‰็š„็›ดๆ’ญๆบๅคชๆ‚๏ผŒไธ”็ผบไนๆฃ€ๆต‹ใ€‚ ไธ€ไบ›ๅคงๆบ็ผบไนๆŒ็ปญๆ›ดๆ–ฐ๏ผŒๅฆ‚ iptv-orgใ€‚ ไฝฟ็”จๆŒ‡ๅ—ไธŽ TODO ๆฏๆฌก่ฟ›่กŒๅคงๆ›ดๆ–ฐๅŽ้ƒฝไผš่ฟ›่กŒไธ€ๆฌก rel

abc1763613206 171 Dec 11, 2022