Giter VIP home page Giter VIP logo

bookmarks-to-notion's Introduction

Bookmarks2Notion


Bookmarks2Notion is a script designed to import your browser bookmarks into Notion. Using a combination of web scraping and OpenAI API, it creates a new page in your Notion database for each bookmarked URL, allowing you to easily organize and access your bookmarks in one central location.


Table of Contents


Screenshots

Script running:

image

Pages created in the Notion DB

image

Generated page content (includes direct link, title, and description enriched with AI)

image



(back to top)

Prerequisites

In order to run this script, you will need:

  • Python 3.8 or higher
  • A Notion account
  • An OpenAI account
  • The bookmarks file you want to import into Notion (compatible with any text format: *.txt, *.html, etc)



(back to top)

How to run

  1. Rename .env.template to .env
  2. Inside .env set the value to environment variables (How to do that?)
  3. Add your URL's inside the file you specified. (default is bookmarks.txt)
  4. Install the required Python packages using pip.
pip install -r requirements.txt
  1. Run the script:
py main.py

The script will read the URLs from the bookmarks file, scrape each web page, process the scraped information, and create a new page in your Notion DB.



(back to top)

Environment variables

  • BOOKMARKS_FILE: Relative path to your bookmarks file. (Required)
  • OPENAI_API_KEY: Your OpenAI's API. (Required)
  • NOTION_API_KEY: Your Notion's API. (Required)
  • NOTION_DB_ID: The ID of the Notion database where the pages will be created. (Required)
  • USER_AGENT: The User-Agent header value to be used when making HTTP requests. (Optional)
  • LANGUAGE: The language to be used when processing the scraped information with OpenAI's language model. (Optional)

Note: Instructions on how to get the API key values and database ID can be found in the How to get required API key values section.



(back to top)

How to get required API key values

Instructions to get required API key values:

How to get OPENAI_API_KEY

To generate an OpenAI API key, follow these steps:

  1. Go directly to OpenAI API keys section: https://platform.openai.com/api-keys) (You must be logged in)
  2. Click on "Create new secret key"

image

  1. Now you can choose a name, after that click on "Create secret key"

image

  1. That's it, now you got the value for OPENAI_API_KEY

image

Note: You may need to provide additional information or complete additional steps to verify your identity or payment information before you can generate an API key.

How to get NOTION_API_KEY

To generate a Notion API key, follow these steps:

  1. Go to my integrations page: https://www.notion.com/my-integrations (You must be logged in)
  2. Click on 'Create new integration'

image

  1. Fill this form and click 'Submit'

image

  1. Now here is your Notion API key, click on 'Show' and copy it!

image

  1. Congrats, now you got the value for NOTION_API_KEY.

How to get NOTION_DB_ID

To find the Notion database ID, follow these steps:

  1. Go to the Notion website (https://www.notion.com/).
  2. Log in to your account.
  3. Create a new database
  4. Give access to Bookmarks-to-Notion integration. Just click three dots icon -> Connect to -> Bookmarks-to-Notion

image

  1. Click on 'Share' and click on 'Copy link' button.

image

  1. Paste the link into a text editor or a web browser.
  2. Look for the string of characters between the last two slashes in the URL. This is the database ID.

image

  1. Copy the database ID and you got the value for NOTION_DB_ID.




(back to top)

License

This project is released under the MIT License.


About developer

Visit my web Carlos Ochoa



Note: If you encounter any issues with the script, please report them here. Contributions are welcome!

bookmarks-to-notion's People

Contributors

carlosulisesochoa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.