Skip to content

SeaGL/seagl-sns-generator

Repository files navigation

SeaGL SNS Generator

A Python program that reads pretalx schedule JSON exports and generates social media posts for Twitter, Bluesky, and Mastodon platforms.

Features

  • Multi-platform support: Generates posts optimized for Twitter (280 chars), Bluesky (300 chars), and Mastodon (500 chars)
  • Smart formatting: Automatically adjusts content length and format for each platform
  • Contextual hashtags: Automatically generates relevant hashtags based on talk content, track, and keywords
  • CSV export: Export posts as CSV files for Buffer.com bulk scheduling
  • Flexible input: Supports standard pretalx JSON export formats
  • Customizable: Configurable event details, hashtags, and URLs
  • Date filtering: Option to generate posts for specific dates
  • Organized output: Saves posts to separate files for each platform

Hashtag Generation

The program intelligently generates contextual hashtags based on:

  • Talk track: Maps conference tracks to relevant hashtags (e.g., "Security and Privacy" → #security #privacy)
  • Keywords: Scans talk titles and abstracts for technology keywords (e.g., "Python" → #python, "Kubernetes" → #kubernetes)
  • Content analysis: Identifies relevant topics like #ai, #devops, #web, #cli, etc.
  • Character limits: Dynamically adjusts hashtag count based on platform limits

Examples of contextual hashtags:

  • "SSH Certificates" → #SeaGL2025 #security #ssh #infosec
  • "Duality of Python" → #SeaGL2025 #programming #python #FLOSS
  • "Observability Datastores" → #SeaGL2025 #cloud #observability #database
  • "Nextcloud Development" → #SeaGL2025 #programming #nextcloud #api

Installation

This program requires Python 3.6+ and uses only standard library modules, so no additional dependencies are needed.

git clone <repository-url>
cd seagl-sns-generator

Usage

Basic Usage

python3 main.py schedule.json

This will:

  1. Parse the pretalx schedule JSON file
  2. Generate social media posts for all platforms
  3. Save the posts to the output/ directory

Advanced Usage

python3 main.py schedule.json \
  --event-name "SeaGL 2025" \
  --event-hashtag "#SeaGL2025" \
  --event-url "https://seagl.org" \
  --output-dir "social_posts" \
  --filter-date "2025-10-10"

Command Line Options

  • schedule_file: Path to the pretalx schedule JSON file (required)
  • --event-name: Name of the event (default: "SeaGL")
  • --event-hashtag: Main event hashtag (default: "#SeaGL")
  • --event-url: Event website URL (default: "https://seagl.org")
  • --output-dir: Output directory for generated posts (default: "output")
  • --filter-date: Filter talks for specific date in YYYY-MM-DD format

CSV Export Options (for Buffer.com)

  • --csv-export: Enable CSV export for Buffer.com bulk import
  • --posts-per-day: Number of posts per day for scheduling (distributed 9 AM - 9 PM)
  • --image-base-url: Base URL for images (combined with slug/code + .png)
  • --image-field: Field to use for image filename (choices: "slug", "code", default: "slug")

CSV Export for Buffer.com

Generate CSV files for bulk importing into Buffer.com:

# Basic CSV export
python3 main.py schedule.json --csv-export

# CSV with scheduled posting (3 posts per day, 9 AM - 9 PM)
python3 main.py schedule.json --csv-export --posts-per-day 3

# CSV with images
python3 main.py schedule.json --csv-export \
  --image-base-url "https://seagl.org/images" \
  --image-field "slug"

Output

Text Files

The program generates three text files in the output directory:

  • twitter_posts.txt: Posts optimized for Twitter (280 character limit)
  • bluesky_posts.txt: Posts optimized for Bluesky (300 character limit)
  • mastodon_posts.txt: Posts optimized for Mastodon (500 character limit)

CSV Files (when --csv-export is used)

  • twitter_buffer_import.csv: Twitter posts for Buffer.com import
  • bluesky_buffer_import.csv: Bluesky posts for Buffer.com import
  • mastodon_buffer_import.csv: Mastodon posts for Buffer.com import

Each CSV includes columns: text, image_url, tags (always empty), posting_time

Each file contains all posts for that platform with character count information.

Pretalx JSON Format

The program supports multiple pretalx schedule export formats:

Standard Pretalx Export Format

The program automatically handles the real pretalx export format used by conferences:

{
  "schedule": {
    "conference": {
      "days": [
        {
          "date": "2025-11-07",
          "day_start": "2025-11-07T04:00:00-08:00",
          "rooms": {
            "Room Name": [
              {
                "title": "Talk Title",
                "date": "2025-11-07T09:10:00-08:00",
                "start": "09:10",
                "duration": "00:30",
                "persons": [
                  {"public_name": "Speaker Name"}
                ],
                "abstract": "Talk description...",
                "url": "https://example.com/talk"
              }
            ]
          }
        }
      ]
    }
  }
}

Alternative Simple Format

For custom schedules or simplified data:

{
  "talks": [
    {
      "title": "Talk Title",
      "speakers": ["Speaker Name"],
      "start": "2025-10-10T09:00:00-07:00",
      "duration": "45",
      "room": "Room Name",
      "track": "Track Name",
      "abstract": "Talk description...",
      "url": "https://example.com/talk"
    }
  ]
}

The program handles both formats automatically.

Post Templates

Twitter/Bluesky (Short Format)

📅 [Time]: "[Title]" by [Speaker(s)] in [Room] #SeaGL2025 #[contextual] #[hashtags] [URL]

Mastodon (Detailed Format)

🎤 Upcoming at SeaGL:
📍 [Time] on [Date]
🗣️ "[Title]"
👥 Speaker(s): [Speaker(s)]
📍 Room: [Room]
🏷️ Track: [Track]
📝 [Abstract snippet...]

#SeaGL2025 #[contextual] #[hashtags] #[based] #[on] #[content]
🔗 [URL]

The hashtags are dynamically generated based on talk content, replacing generic tags with relevant ones like #python, #kubernetes, #security, #ai, etc.

Example

Try the program with the included sample data:

python3 main.py sample_schedule.json

This will generate example posts for a fictional SeaGL schedule.

Customization

The program uses several default hashtags and formatting options that can be modified in the SocialMediaPostGenerator class:

  • common_hashtags: Additional hashtags to include
  • Post templates and formatting
  • Character limits and truncation logic
  • Date/time formatting

Error Handling

The program handles common issues gracefully:

  • Missing or invalid JSON files
  • Incomplete talk data
  • Character limit violations
  • Missing speaker or time information

Contributing

Feel free to submit issues and enhancement requests!

License

This project is open source. Please check the LICENSE file for details.

About

Script to generate social media posts from a pretalx exported schedule.

Resources

License

Stars

Watchers

Forks

Languages