This script exports the content of a "Транскрипт интервью" toggle from a Notion database to a text file. It can also optionally delete the content from the original Notion card.
- Install Python: Make sure you have Python 3.6+ installed.
- Install dependencies: Install the required Python libraries using pip:
pip install -r requirements.txt
- Create a Notion integration:
- Go to https://www.notion.so/my-integrations and create a new integration.
- Give it a name (e.g., "Transcript Exporter").
- Copy the "Internal Integration Token". You will use this as the
--notion-token.
- Share the database with your integration:
- Go to your Notion database.
- Click the "..." menu in the top right corner.
- Click "Add connections" and select your newly created integration.
- Get the Database ID:
- Open your database in Notion.
- The URL will look something like this:
https://www.notion.so/your-workspace/DATABASE_ID?v=... - The
DATABASE_IDis the long string of characters between your workspace name and the?v=. You will use this as the--database-id.
Run the script from your terminal, providing your Notion token and database ID:
python clear_transcripts.py --notion-token <your_notion_token> --database-id <your_database_id>To delete the transcripts from Notion after exporting, use the --delete flag:
python clear_transcripts.py --notion-token <your_notion_token> --database-id <your_database_id> --deleteFor testing, you can limit the number of pages processed with the --limit flag:
python clear_transcripts.py --notion-token <your_notion_token> --database-id <your_database_id> --limit 5