Skip to main content

Modular Python CLI tool to automatically post new entries from an RSS or Atom feed to one or more social media platforms. Easily extensible, robust, and safe for automation and CI/CD workflows.

Project description

rss2socials

PyPI version Python versions Build Status Coverage Status License: MIT Downloads

rss2socials is a modular Python CLI tool that automatically posts new entries from an RSS or Atom feed to one or more social media platforms. It is designed to be easily extensible, robust, and safe for automation and CI/CD workflows.

Features

  • Dynamic connector system: Add new social media platforms by simply dropping a connector module in src/rss2socials/connector/.
  • Automatic deduplication: Tracks posted links to avoid reposting.
  • OpenAI-powered summaries: Generates concise, platform-appropriate summaries for each post.
  • Flexible CLI: Configure via command-line arguments or environment variables.
  • Comprehensive logging: Supports configurable log levels for debugging and automation.
  • Tested and maintainable: 100% test coverage for core modules, with robust error handling.

Installation

From PyPI

pip install rss2socials

From Source (Recommended for Development)

Clone the repository and install all dependencies (main + dev) using pip-tools and a pinned requirements file for reproducibility:

git clone https://github.com/ugns/rss2socials.git
cd rss2socials
pip install pip-tools
pip-compile --extra dev --strip-extras --output-file=requirements.txt pyproject.toml
pip install -r requirements.txt
  • This will install the package in editable mode along with all development tools (pytest, flake8, etc.).
  • You can also use make dev to automate these steps.

Requirements

  • Python 3.9 or newer is required.

Usage

Using the CLI Entrypoint

After installation, you can use the CLI entrypoint (if installed from PyPI or with pip):

rss2socials --feed-url https://example.com/feed.xml --platform bluesky

Or, if you prefer to use the Python module directly:

python -m rss2socials --feed-url https://example.com/feed.xml --platform bluesky

Both commands are equivalent and will invoke the CLI interface.

As a Library

You can also use rss2socials as a Python library in your own scripts:

from rss2socials.cli import main

# Call main() with sys.argv-style arguments
main([
    "--feed-url", "https://example.com/feed.xml",
    "--platform", "bluesky"
])

CLI Options

  • --feed-url (or FEED_URL env): RSS/Atom feed URL (required)
  • --platform: One or more platforms to post to (default: bluesky; auto-discovers available platforms)
  • --seen-file: File to track posted links (default: seen_rss_posts.txt)
  • --post-age-limit-days: Only post entries newer than this many days (default: 7)
  • --log-level: Logging level (default: INFO)

Dynamic Connector System

To add support for a new social media platform:

  1. Create a new Python file in src/rss2socials/connector/ (e.g., myplatform.py).
  2. Implement a post(summary, link, fetch_page_metadata) function and set a PLATFORM string (e.g., PLATFORM = "myplatform").
  3. Optionally, set MAX_GRAPHEMES for platform-specific length limits.

The CLI will automatically discover and make your platform available as a --platform option. No changes to the core code are required.

Example connector skeleton:

PLATFORM = "myplatform"
MAX_GRAPHEMES = 300

def post(summary, link, fetch_page_metadata):
    # Implement posting logic here
    return True  # Return True if successful

Environment Variables

  • OPENAI_API_KEY: Required for summary generation
  • FEED_URL, SEEN_FILE, POST_AGE_LIMIT_DAYS, LOG_LEVEL, PLATFORM: Optional, override CLI args
  • Connector-specific variables:
    • For Bluesky:
      • BLUESKY_HANDLE: Your Bluesky username (required)
      • BLUESKY_APP_PASSWORD: Your Bluesky app password (required)
    • Other connectors may require their own environment variables; see the connector's documentation or source code for details.

Development & Testing

  • Install all dependencies: make dev
  • Run tests: make test (uses tox for all supported Python versions)
  • Lint: make lint
  • Coverage: make coverage
  • Add new connectors in src/rss2socials/connector/
  • Regenerate constraints after dependency changes: make freeze

License

MIT

Contributing

Contributions are welcome! Please use Conventional Commits and ensure all tests pass before submitting a PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rss2socials-1.1.23.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rss2socials-1.1.23-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file rss2socials-1.1.23.tar.gz.

File metadata

  • Download URL: rss2socials-1.1.23.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rss2socials-1.1.23.tar.gz
Algorithm Hash digest
SHA256 de31e31fff90b405bdcb2c15ad7a8125c5b313f9ae8c8048bbc4b5f6ae21acac
MD5 b318f0719a72f5e93360fab41492bc8c
BLAKE2b-256 0a29ba7b96e606d80fcaca35ccba0d37650c3e4751921e59dcc8710137241a4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rss2socials-1.1.23.tar.gz:

Publisher: ci.yml on ugns/rss2socials

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rss2socials-1.1.23-py3-none-any.whl.

File metadata

  • Download URL: rss2socials-1.1.23-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rss2socials-1.1.23-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c656f6f06d07faff395e0372016ab22804e9143990267adf23f644f252a92c
MD5 4ab92e76c0f4d87ab30cac6e0892d64a
BLAKE2b-256 8fd6240214abf0b7156f4cfa367c055d98b5bf171e603e74dbd7f6cd0805589b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rss2socials-1.1.23-py3-none-any.whl:

Publisher: ci.yml on ugns/rss2socials

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page