
This script automatically takes screenshots of web pages and uploads them to a specific Notion database page. It works with Notion's API and uses Selenium for web crawling and Cloudinary for external image serving.
How I achieved it with no programming basics »
View Demo
·
Report Bug
·
Request Feature
This project utilizes several key Python libraries and frameworks:
Selenium
: Used for web scraping and taking screenshots of web pages.
Cloudinary
: Provides cloud-based image hosting services.
Requests
: Used for making HTTP requests to the Notion API.
webdriver_manager
: Simplifies the management of ChromeDriver for Selenium.
json
: Used for parsing and creating JSON data.
logging
: Provides a flexible framework for generating log messages.
base64
: Used for encoding and decoding the screenshot data.
time
: Used for adding delays and handling timeouts.
All coding driven by AI. ( Claude
, ChatGPT
, Mistral
)
- Fetches pages from a specified Notion database
- Takes screenshots of URLs found in the database pages
- Uploads screenshots to Cloudinary
- Updates Notion pages with the screenshot URLs
- Implements retry logic and error handling
- Tracks processed URLs to avoid duplicates
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
- Python 3.7+
- Chrome browser
- Notion API key
- Cloudinary account
-
Clone this repository:
git clone https://github.com/kinpoe-ray/chrome-screenshot-to-notion cd chrome-screenshot-to-notion
-
Install required packages:
pip install -r requirements.txt
-
Install ChromeDriver (if not already installed):
pip install webdriver_manager
-
Open the script and update the following variables:
notion_api_key
: Your Notion API keydatabase_id
: The ID of your Notion database- Cloudinary configuration in the
upload_to_image_hosting_service
functioncloud_name
: Your user nameapi_key
: Your API keyapi_secret
: Your API secret
-
Adjust the
max_screenshots
variable if needed (default is 50)
Run the script with:
python chrome-screenshot-to-notion.py
The script will:
- Fetch pages from the specified Notion database
- Take screenshots of URLs found in the pages
- Upload screenshots to Cloudinary
- Update Notion pages with the screenshot URLs
The script logs its progress and any errors to the console. You can adjust the logging level in the script if needed.
- The script implements retry logic for API calls
- It uses exponential backoff for failed attempts
- Processed URLs are saved to avoid duplicates even if the script is interrupted
- The script is set to run headless. Modify Chrome options if you need to see the browser while running
- It's designed to work with specific Notion page properties ('file' and 'url'). Adjust as needed for your database structure
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
MIT License