or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication.mdbrowse.mdcache.mdclient.mdindex.mdplayback.mdplaylists.mdpodcasts.mduser-library.md

podcasts.mddocs/

0

# Podcasts and Shows

1

2

Access podcast shows, episodes, and audiobook content with comprehensive metadata and user library integration. Spotify provides extensive podcast catalog with detailed episode information and user management features.

3

4

## Capabilities

5

6

### Show Information

7

8

Access podcast show details and metadata.

9

10

```python { .api }

11

def show(self, show_id, market=None):

12

"""

13

Get show information.

14

15

Args:

16

show_id (str): Spotify show ID or URI

17

market (str, optional): ISO 3166-1 alpha-2 country code

18

19

Returns:

20

dict: Show object with metadata, episodes, and publisher info

21

"""

22

23

def shows(self, shows, market=None):

24

"""

25

Get multiple shows.

26

27

Args:

28

shows (list): List of show IDs or URIs (max 50)

29

market (str, optional): ISO 3166-1 alpha-2 country code

30

31

Returns:

32

dict: Shows object containing list of show objects

33

"""

34

```

35

36

### Show Episodes

37

38

Access episodes within podcast shows.

39

40

```python { .api }

41

def show_episodes(self, show_id, limit=50, offset=0, market=None):

42

"""

43

Get episodes from a show.

44

45

Args:

46

show_id (str): Spotify show ID or URI

47

limit (int): Number of episodes to return (1-50, default: 50)

48

offset (int): Index of first episode (default: 0)

49

market (str, optional): ISO 3166-1 alpha-2 country code

50

51

Returns:

52

dict: Paging object of simplified episode objects

53

"""

54

```

55

56

### Episode Information

57

58

Access individual episode details and metadata.

59

60

```python { .api }

61

def episode(self, episode_id, market=None):

62

"""

63

Get episode information.

64

65

Args:

66

episode_id (str): Spotify episode ID or URI

67

market (str, optional): ISO 3166-1 alpha-2 country code

68

69

Returns:

70

dict: Episode object with metadata, show info, and playback details

71

"""

72

73

def episodes(self, episodes, market=None):

74

"""

75

Get multiple episodes.

76

77

Args:

78

episodes (list): List of episode IDs or URIs (max 50)

79

market (str, optional): ISO 3166-1 alpha-2 country code

80

81

Returns:

82

dict: Episodes object containing list of episode objects

83

"""

84

```

85

86

### Audiobook Content

87

88

Access audiobook information and chapters.

89

90

```python { .api }

91

def get_audiobook(self, id, market=None):

92

"""

93

Get audiobook information.

94

95

Args:

96

id (str): Spotify audiobook ID or URI

97

market (str, optional): ISO 3166-1 alpha-2 country code

98

99

Returns:

100

dict: Audiobook object with metadata, authors, and narrator info

101

"""

102

103

def get_audiobooks(self, ids, market=None):

104

"""

105

Get multiple audiobooks.

106

107

Args:

108

ids (list): List of audiobook IDs or URIs (max 50)

109

market (str, optional): ISO 3166-1 alpha-2 country code

110

111

Returns:

112

dict: Audiobooks object containing list of audiobook objects

113

"""

114

115

def get_audiobook_chapters(self, id, market=None, limit=20, offset=0):

116

"""

117

Get chapters from an audiobook.

118

119

Args:

120

id (str): Spotify audiobook ID or URI

121

market (str, optional): ISO 3166-1 alpha-2 country code

122

limit (int): Number of chapters to return (1-50, default: 20)

123

offset (int): Index of first chapter (default: 0)

124

125

Returns:

126

dict: Paging object of simplified chapter objects

127

"""

128

```

129

130

## Usage Examples

131

132

### Exploring Podcast Shows

133

134

```python

135

import spotipy

136

from spotipy.oauth2 import SpotifyClientCredentials

137

138

sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())

139

140

# Search for popular podcast shows

141

results = sp.search(q='true crime', type='show', limit=10)

142

shows = results['shows']['items']

143

144

print("πŸŽ™οΈ True Crime Podcast Shows:")

145

for show in shows:

146

print(f"\\nπŸ“» {show['name']}")

147

print(f" Publisher: {show['publisher']}")

148

print(f" Description: {show['description'][:100]}...")

149

print(f" Total Episodes: {show['total_episodes']}")

150

print(f" Languages: {', '.join(show['languages'])}")

151

print(f" Explicit: {'Yes' if show['explicit'] else 'No'}")

152

153

if show['images']:

154

print(f" Cover: {show['images'][0]['url']}")

155

156

# Get detailed information for a specific show

157

if shows:

158

show_id = shows[0]['id']

159

detailed_show = sp.show(show_id)

160

161

print(f"\\nπŸ” Detailed info for '{detailed_show['name']}':")

162

print(f" Media Type: {detailed_show['media_type']}")

163

print(f" Available Markets: {len(detailed_show['available_markets'])} markets")

164

print(f" Copyright: {detailed_show['copyrights'][0]['text'] if detailed_show['copyrights'] else 'N/A'}")

165

```

166

167

### Browsing Episodes

168

169

```python

170

# Get episodes from a show

171

show_id = "4rOoJ6Egrf8K2IrywzwOMk" # Example show ID

172

173

# Get recent episodes

174

episodes = sp.show_episodes(show_id, limit=20)

175

print(f"πŸ“Ί Recent episodes ({episodes['total']} total):")

176

177

for episode in episodes['items']:

178

print(f"\\n🎧 {episode['name']}")

179

print(f" Description: {episode['description'][:150]}...")

180

print(f" Duration: {episode['duration_ms'] // 60000} minutes")

181

print(f" Release Date: {episode['release_date']}")

182

print(f" Language: {', '.join(episode['languages'])}")

183

print(f" Explicit: {'Yes' if episode['explicit'] else 'No'}")

184

185

# Check if episode has external URLs

186

if episode['external_urls']:

187

print(f" Spotify URL: {episode['external_urls']['spotify']}")

188

189

# Get detailed episode information

190

if episodes['items']:

191

episode_id = episodes['items'][0]['id']

192

detailed_episode = sp.episode(episode_id)

193

194

print(f"\\nπŸ” Detailed episode info:")

195

print(f" Show: {detailed_episode['show']['name']}")

196

print(f" Episode Type: {detailed_episode.get('type', 'episode')}")

197

print(f" Resume Point: {detailed_episode.get('resume_point', {}).get('resume_position_ms', 0) // 1000}s")

198

print(f" Fully Played: {detailed_episode.get('resume_point', {}).get('fully_played', False)}")

199

```

200

201

### Audiobook Exploration

202

203

```python

204

# Search for audiobooks

205

audiobook_results = sp.search(q='mystery', type='audiobook', limit=5)

206

audiobooks = audiobook_results['audiobooks']['items']

207

208

print("πŸ“š Mystery Audiobooks:")

209

for audiobook in audiobooks:

210

print(f"\\nπŸ“– {audiobook['name']}")

211

print(f" Authors: {', '.join([author['name'] for author in audiobook['authors']])}")

212

print(f" Narrators: {', '.join([narrator['name'] for narrator in audiobook['narrators']])}")

213

print(f" Publisher: {audiobook['publisher']}")

214

print(f" Description: {audiobook['description'][:100]}...")

215

print(f" Total Chapters: {audiobook['total_chapters']}")

216

print(f" Languages: {', '.join(audiobook['languages'])}")

217

print(f" Explicit: {'Yes' if audiobook['explicit'] else 'No'}")

218

219

# Get chapters from an audiobook

220

if audiobooks:

221

audiobook_id = audiobooks[0]['id']

222

chapters = sp.get_audiobook_chapters(audiobook_id, limit=10)

223

224

print(f"\\nπŸ“‘ Chapters from '{audiobooks[0]['name']}':")

225

for i, chapter in enumerate(chapters['items'], 1):

226

duration_min = chapter['duration_ms'] // 60000

227

print(f" Chapter {i}: {chapter['name']} ({duration_min} min)")

228

print(f" Description: {chapter['description'][:80]}...")

229

print(f" Chapter Number: {chapter.get('chapter_number', 'N/A')}")

230

```

231

232

### Podcast Discovery and Analysis

233

234

```python

235

def analyze_podcast_show(show_id):

236

"""Analyze a podcast show's episodes and patterns."""

237

238

show = sp.show(show_id)

239

print(f"πŸ“Š Analysis for '{show['name']}':")

240

print(f"Publisher: {show['publisher']}")

241

print(f"Total Episodes: {show['total_episodes']}")

242

243

# Get all episodes

244

all_episodes = []

245

episodes = sp.show_episodes(show_id, limit=50)

246

all_episodes.extend(episodes['items'])

247

248

while episodes['next']:

249

episodes = sp.next(episodes)

250

all_episodes.extend(episodes['items'])

251

252

if all_episodes:

253

# Calculate statistics

254

durations = [ep['duration_ms'] for ep in all_episodes]

255

avg_duration = sum(durations) / len(durations)

256

257

# Count explicit episodes

258

explicit_count = sum(1 for ep in all_episodes if ep.get('explicit', False))

259

260

# Get release pattern (episodes per month)

261

from collections import defaultdict

262

import datetime

263

264

release_months = defaultdict(int)

265

for episode in all_episodes:

266

if episode['release_date']:

267

try:

268

date = datetime.datetime.strptime(episode['release_date'], '%Y-%m-%d')

269

month_key = f"{date.year}-{date.month:02d}"

270

release_months[month_key] += 1

271

except:

272

pass

273

274

print(f"\\nπŸ“ˆ Episode Statistics:")

275

print(f" Average Duration: {avg_duration / 60000:.1f} minutes")

276

print(f" Longest Episode: {max(durations) / 60000:.1f} minutes")

277

print(f" Shortest Episode: {min(durations) / 60000:.1f} minutes")

278

print(f" Explicit Episodes: {explicit_count}/{len(all_episodes)} ({explicit_count/len(all_episodes)*100:.1f}%)")

279

280

print(f"\\nπŸ“… Recent Release Pattern:")

281

recent_months = sorted(release_months.keys())[-6:] # Last 6 months

282

for month in recent_months:

283

print(f" {month}: {release_months[month]} episodes")

284

285

# Show recent episodes

286

print(f"\\nπŸ†• Most Recent Episodes:")

287

for episode in all_episodes[:5]:

288

print(f" β€’ {episode['name']} ({episode['release_date']})")

289

print(f" {episode['duration_ms'] // 60000} min - {episode['description'][:60]}...")

290

291

# Analyze a popular podcast

292

# Example: The Joe Rogan Experience (if available in your market)

293

try:

294

# You would need to find the actual show ID

295

# analyze_podcast_show("4rOoJ6Egrf8K2IrywzwOMk")

296

pass

297

except Exception as e:

298

print(f"Could not analyze show: {e}")

299

```

300

301

### Content Discovery by Category

302

303

```python

304

def discover_podcasts_by_genre(genre_query, limit=10):

305

"""Discover podcasts by genre or topic."""

306

307

# Search for shows

308

results = sp.search(q=genre_query, type='show', limit=limit)

309

shows = results['shows']['items']

310

311

print(f"🎭 '{genre_query.title()}' Podcasts:")

312

313

show_stats = []

314

315

for show in shows:

316

print(f"\\nπŸ“» {show['name']}")

317

print(f" Publisher: {show['publisher']}")

318

print(f" Episodes: {show['total_episodes']}")

319

print(f" Languages: {', '.join(show['languages'])}")

320

321

# Get a few recent episodes to analyze

322

try:

323

recent_episodes = sp.show_episodes(show['id'], limit=5)

324

if recent_episodes['items']:

325

avg_duration = sum(ep['duration_ms'] for ep in recent_episodes['items']) / len(recent_episodes['items'])

326

print(f" Avg Episode Length: {avg_duration / 60000:.1f} minutes")

327

328

# Check update frequency

329

episodes = recent_episodes['items']

330

if len(episodes) >= 2:

331

try:

332

from datetime import datetime

333

date1 = datetime.strptime(episodes[0]['release_date'], '%Y-%m-%d')

334

date2 = datetime.strptime(episodes[1]['release_date'], '%Y-%m-%d')

335

days_between = abs((date1 - date2).days)

336

print(f" Update Frequency: ~{days_between} days between episodes")

337

except:

338

pass

339

except:

340

pass

341

342

show_stats.append({

343

'name': show['name'],

344

'episodes': show['total_episodes'],

345

'publisher': show['publisher']

346

})

347

348

# Summary statistics

349

if show_stats:

350

total_episodes = sum(s['episodes'] for s in show_stats)

351

avg_episodes = total_episodes / len(show_stats)

352

353

print(f"\\nπŸ“Š Genre Summary:")

354

print(f" Total Shows Found: {len(show_stats)}")

355

print(f" Total Episodes: {total_episodes}")

356

print(f" Average Episodes per Show: {avg_episodes:.1f}")

357

358

# Top publishers

359

publishers = {}

360

for show in show_stats:

361

pub = show['publisher']

362

publishers[pub] = publishers.get(pub, 0) + 1

363

364

print(f" Top Publishers:")

365

for pub, count in sorted(publishers.items(), key=lambda x: x[1], reverse=True)[:3]:

366

print(f" {pub}: {count} shows")

367

368

# Discover different podcast genres

369

genres = ['technology', 'comedy', 'news', 'business', 'health']

370

for genre in genres:

371

discover_podcasts_by_genre(genre, 5)

372

print("-" * 60)

373

```

374

375

### Episode Queue Management

376

377

```python

378

def create_podcast_queue(show_ids, episodes_per_show=3):

379

"""Create a listening queue from multiple podcast shows."""

380

381

queue = []

382

383

for show_id in show_ids:

384

try:

385

show = sp.show(show_id)

386

episodes = sp.show_episodes(show_id, limit=episodes_per_show)

387

388

for episode in episodes['items']:

389

queue.append({

390

'show_name': show['name'],

391

'episode_name': episode['name'],

392

'duration_minutes': episode['duration_ms'] // 60000,

393

'release_date': episode['release_date'],

394

'description': episode['description'][:100] + '...',

395

'uri': episode['uri']

396

})

397

except Exception as e:

398

print(f"Error processing show {show_id}: {e}")

399

400

# Sort by release date (newest first)

401

queue.sort(key=lambda x: x['release_date'], reverse=True)

402

403

print(f"🎧 Podcast Listening Queue ({len(queue)} episodes):")

404

total_duration = sum(ep['duration_minutes'] for ep in queue)

405

print(f"Total Duration: {total_duration // 60}h {total_duration % 60}m\\n")

406

407

for i, episode in enumerate(queue, 1):

408

print(f"{i:2d}. [{episode['show_name']}] {episode['episode_name']}")

409

print(f" {episode['duration_minutes']} min | {episode['release_date']} | {episode['description']}")

410

print(f" URI: {episode['uri']}")

411

print()

412

413

return queue

414

415

# Example usage (you would need actual show IDs)

416

# show_ids = ["show_id_1", "show_id_2", "show_id_3"]

417

# podcast_queue = create_podcast_queue(show_ids, 2)

418

```

419

420

### Language and Market Analysis

421

422

```python

423

def analyze_content_by_market(content_type='show', query='news', markets=['US', 'GB', 'DE', 'ES']):

424

"""Analyze how content varies across different markets."""

425

426

print(f"🌍 {content_type.title()} Content Analysis: '{query}'\\n")

427

428

for market in markets:

429

print(f"πŸ“ Market: {market}")

430

431

try:

432

results = sp.search(q=query, type=content_type, market=market, limit=5)

433

items = results[f"{content_type}s"]['items']

434

435

if items:

436

languages = set()

437

publishers = set()

438

439

print(f" Top {content_type}s:")

440

for item in items:

441

name = item['name']

442

publisher = item.get('publisher', 'Unknown')

443

item_languages = item.get('languages', [])

444

445

print(f" β€’ {name} ({publisher})")

446

if item_languages:

447

print(f" Languages: {', '.join(item_languages)}")

448

languages.update(item_languages)

449

publishers.add(publisher)

450

451

print(f"\\n Summary for {market}:")

452

print(f" β€’ Languages found: {', '.join(sorted(languages))}")

453

print(f" β€’ Unique publishers: {len(publishers)}")

454

else:

455

print(f" No {content_type}s found")

456

457

except Exception as e:

458

print(f" Error: {e}")

459

460

print("-" * 40)

461

462

# Analyze podcast content across markets

463

analyze_content_by_market('show', 'politics', ['US', 'GB', 'CA', 'AU'])

464

analyze_content_by_market('audiobook', 'fiction', ['US', 'GB', 'DE'])

465

```

466

467

## Content Types

468

469

### Show Object Fields

470

- `id`, `name`, `description`, `publisher`

471

- `total_episodes`, `languages`, `explicit`

472

- `images`, `available_markets`

473

- `copyrights`, `media_type`

474

475

### Episode Object Fields

476

- `id`, `name`, `description`, `duration_ms`

477

- `release_date`, `languages`, `explicit`

478

- `images`, `show` (simplified show object)

479

- `resume_point` (for authenticated users)

480

481

### Audiobook Object Fields

482

- `id`, `name`, `description`, `publisher`

483

- `authors`, `narrators`, `total_chapters`

484

- `languages`, `explicit`, `images`

485

- `available_markets`, `copyrights`

486

487

Note: Podcast and audiobook availability varies by market. Some content may not be accessible in all regions due to licensing restrictions.