Core API¶
This is the primary public API for podcast_scraper. Use these functions for programmatic access.
Quick Start¶
import podcast_scraper
# Create configuration
cfg = podcast_scraper.Config(
rss="https://example.com/feed.xml",
output_dir="./transcripts",
max_episodes=10
)
# Run the pipeline
count, summary = podcast_scraper.run_pipeline(cfg)
print(f"Downloaded {count} transcripts: {summary}")
API Reference¶
run_pipeline
¶
run_pipeline(cfg: Config) -> Tuple[int, str]
Execute the main podcast scraping pipeline.
This is the primary entry point for programmatic use of podcast_scraper. It orchestrates the complete workflow from RSS feed fetching to transcript generation and optional metadata/summarization.
The pipeline executes the following stages:
- Setup output directory (with optional run ID subdirectory)
- Fetch and parse RSS feed
- Detect speakers (if auto-detection enabled)
- Process episodes concurrently:
- Download published transcripts
- Or queue media for Whisper transcription
- Transcribe queued media files sequentially (if Whisper enabled)
- Generate metadata documents (if enabled)
- Generate episode summaries (if enabled)
- Clean up temporary files
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Config
|
Configuration object with all pipeline settings. See |
required |
Returns:
| Type | Description |
|---|---|
Tuple[int, str]
|
Tuple[int, str]: A tuple containing:
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If output directory cleanup fails when |
ValueError
|
If RSS URL is invalid or feed cannot be parsed |
FileNotFoundError
|
If configuration file references missing files |
OSError
|
If file system operations fail |
Example
from podcast_scraper import Config, run_pipeline
cfg = Config( ... rss="https://example.com/feed.xml", ... output_dir="./transcripts", ... max_episodes=10 ... ) count, summary = run_pipeline(cfg) print(f"Downloaded {count} transcripts: {summary}") Downloaded 10 transcripts: Processed 10/50 episodes
Example with Whisper transcription
cfg = Config( ... rss="https://example.com/feed.xml", ... transcribe_missing=True, ... whisper_model="base", ... screenplay=True, ... num_speakers=2 ... ) count, summary = run_pipeline(cfg)
Note
For non-interactive use (daemons, services), consider using the service.run()
function instead, which provides structured error handling and return values.
See Also
Config: Configuration model with all available optionsservice.run(): Service API with structured error handlingload_config_file(): Load configuration from JSON/YAML file
Source code in src/podcast_scraper/workflow/orchestration.py
2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 | |
load_config_file
¶
load_config_file(path: str) -> Dict[str, Any]
Load configuration from a JSON or YAML file.
This function reads a configuration file and returns a dictionary of configuration values.
The file format is auto-detected from the file extension (.json, .yaml, or .yml).
The returned dictionary can be unpacked into the Config constructor to create a
configuration object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to configuration file (JSON or YAML). Supports tilde expansion for home directory (e.g., "~/config.yaml"). |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Dictionary containing configuration values from the file.
Keys correspond to |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any of the following occur:
|
OSError
|
If file cannot be read due to permissions or I/O errors |
Example
from podcast_scraper import Config, load_config_file, run_pipeline
Load from YAML file¶
config_dict = load_config_file("config.yaml") cfg = Config(**config_dict) count, summary = run_pipeline(cfg)
Example with JSON
config_dict = load_config_file("config.json") cfg = Config(**config_dict)
Example with direct usage
from podcast_scraper import load_config_file, service
Service API provides load_config_file convenience¶
result = service.run_from_config_file("config.yaml")
Supported Formats
JSON (.json):
{
"rss": "https://example.com/feed.xml",
"output_dir": "./transcripts",
"max_episodes": 50
}
YAML (.yaml, .yml):
rss: https://example.com/feed.xml
output_dir: ./transcripts
max_episodes: 50
Note
- Field aliases are supported (e.g., both "rss" and "rss_url" work)
- See
Configdocumentation for all available configuration options - Configuration files should not contain sensitive data (API keys, passwords)
See Also
Config: Configuration model and field documentationservice.run_from_config_file(): Direct service API from config file- Configuration examples:
config/examples/config.example.json,config/examples/config.example.yaml
Source code in src/podcast_scraper/config.py
7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 | |
Package Information¶
Versioning¶
Related¶
- Configuration - Detailed configuration options
- Service API - Non-interactive service interface
- CLI Interface - Command-line interface