Skip to main content

pg-podcast-toolkit

Tools for parsing and managing Podcasting 2.0 RSS feeds with automatic namespace capture and database-ready output.

Features

  • Podcasting 2.0 Support - Automatically captures all podcast:* namespace tags without parser updates
  • Database-Ready Output - Built-in to_db_record() methods for PostgreSQL schema alignment
  • Backward Compatible - Existing code continues to work, new features are opt-in
  • Deterministic IDs - MD5-based ID generation (32-char lowercase hex strings) for podcasts and episodes
  • GUID Fallback - Handles episodes with missing GUIDs gracefully
  • Comprehensive Parsing - Supports RSS 2.0, iTunes extensions, and custom namespaces

Installation

pip install pg-podcast-toolkit

Quick Start

Basic Usage

from pg_podcast_toolkit import Podcast
import requests

# Fetch and parse a podcast feed
response = requests.get('https://example.com/feed.xml')
podcast = Podcast(response.content, feed_url='https://example.com/feed.xml')

# Access podcast metadata
print(podcast.title)
print(podcast.description)
print(podcast.itunes_image)

# Access episodes
for item in podcast.items:
    print(f"{item.title} - {item.itunes_duration}s")

Database Integration (New in v0.2.0)

# Get database-ready podcast record
podcast_record = podcast.to_db_record(
    etag='some-etag',              # Optional HTTP ETag
    last_modified='Wed, 06 Nov',   # Optional Last-Modified header
    last_fetched_at=1234567890     # Optional fetch timestamp
)

# Insert into PostgreSQL
# podcast_record matches schema: id, podcast_guid, title, feed_url,
# image_url, language, itunes_id, etag, last_modified, last_fetched_at,
# created_at, updated_at, extras (JSONB)

# Get database-ready episode records
for item in podcast.items:
    episode_record = item.to_db_record(podcast_id=podcast_record['id'])
    # episode_record matches schema: id, podcast_id, guid, title,
    # description, image_url, publish_date, duration_seconds,
    # episode_number, season_number, episode_type, explicit,
    # enclosure_url, enclosure_type, enclosure_size,
    # created_at, updated_at, extras (JSONB)

Accessing Podcasting 2.0 Namespaces (New in v0.2.0)

# All unknown namespace tags are automatically captured
print(podcast.namespaces)
# {
#   'podcast': {
#     'guid': {'value': '...'},
#     'locked': {'value': 'yes', 'attributes': {'owner': 'email@example.com'}},
#     'funding': {'value': 'Support!', 'attributes': {'url': 'https://...'}},
#     'person': [
#       {'value': 'Host Name', 'attributes': {'role': 'host', 'img': '...'}},
#       ...
#     ]
#   }
# }

# Episode-level namespaces
for item in podcast.items:
    print(item.namespaces)
    # {
    #   'podcast': {
    #     'chapters': {'attributes': {'url': '...', 'type': 'application/json'}},
    #     'transcript': {'attributes': {'url': '...', 'type': 'text/srt'}},
    #     'person': [...],
    #     ...
    #   }
    # }

What's New in v0.2.0

  • Automatic Namespace Capture - No parser updates needed for new Podcasting 2.0 tags
  • Database-Ready Methods - Podcast.to_db_record() and Item.to_db_record()
  • Schema Alignment - Output matches PostgreSQL schema with MD5 hex string primary keys
  • GUID Fallback - Episodes without GUIDs use enclosure_url for ID generation
  • 100% Backward Compatible - All existing attributes and methods unchanged

Supported Specifications

  • RSS 2.0
  • iTunes Podcast Extensions
  • Podcasting 2.0 Namespace (automatic capture)
  • Custom namespace extensions (automatic capture)

Development Status

This library is actively maintained and production-ready. The v0.2.0 release introduces database integration features while maintaining full backward compatibility.

License

MIT License

Download files

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

Source Distribution

pg_podcast_toolkit-0.3.3.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

pg_podcast_toolkit-0.3.3-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file pg_podcast_toolkit-0.3.3.tar.gz.

File metadata

  • Download URL: pg_podcast_toolkit-0.3.3.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pg_podcast_toolkit-0.3.3.tar.gz
Algorithm Hash digest
SHA256 adbc80db8d721af35325cddb252fa78b8dde5320f2e0a7fbbd61a5e42c12b3e2
MD5 6552fac49efd13334487da6e91d3a73e
BLAKE2b-256 d522dc67faf420a6ec07fd2179d608255ffbb2bf39747e163f9978c33c7d7b19

See more details on using hashes here.

File details

Details for the file pg_podcast_toolkit-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pg_podcast_toolkit-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b33a3917cb32a28c413dd5a7a954a4b57de4660bd6465ab54e9b9b6a5e182098
MD5 f6135bf87a358ea7511d5d114ceb4c62
BLAKE2b-256 779cdab6dea569f899b1c968376f8960b01a190472740c22ea19359d5f4f2857

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

This release

0.3.3 This release

2 files

0.3.1

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page