Build your own Notion Safari Extension and make it even better!
-
Install the necessary python packages
pip install -r requirements.txt
-
Create your own notion configuration file:
-
Fetch the Notion token from your browser. Firstly log into your Notion account in Chrome. On your Notion page, open the inspector panel using Command+Shift+C, follow the instructions shown in the figure below.
-
Fill in the token and page name/link in the notion configuration file based on the template.
- For
<page-link>
, it's link to the given Notion page, e.g., https://www.notion.so/xxx/xxxx. It can be a regular page or database. - For
<page-name>
, it doesn't need to the same as the page name in Notion.
- For
-
-
Add the absolute path of the notion configuration file to the
automator_script.js
(line 11) andsafari2notion.py
(line 17) file. -
Open the
automator
App on your Mac and create a new file (Command + N). Follow the instruction shown below to create a macQuick Action
and add theautomator_script.js
code to it. Note: Theautomator_script.js
only saves the current tab, while theautomator_script_batch.js
saves all the tabs in the front window. You can choose the script to paste based on your need, but please remember to change the path to notion configuration in the file. -
Bind the automation with the python script
safari2notion.py
using the code/path/to/your/python ~/path/to/safari2notion.py "$@"
, and save the automation assafari2notion
. Then you can find it in the Service menu in Safari.
Congratulations! You've finished the configuration. You can further customize the code by modifying the lib/processor.py
and safari2notion.py
to your demand.
The functionality in lib/processor.Paper
supports automatic parsing of arxiv links. You can easily use that to generate and store a paper's meta information based on its arxiv paper link.
- Creating a Notion page as database, and add the
Authors
andURL
column (case sensitive). - Add the page-link and and name
Paper
to the"pages"
object in your notion configuration file:"pages": { "Paper": "https://notion.so/xxx/xxxx" }
- On an arxiv page, click the
safari2notion
service to add the paper to your Notion page.