Skip to content

Conversation

@Harishankar14
Copy link
Contributor

Fixes #201

Summary

This PR updates the builtin.channelVideos resource to support retrieving extended video metadata that is not available through the playlistItems resource alone.

To achieve this, the logic has been refactored to perform a two-step fetch:

  1. Retrieve video IDs via the channel's uploads playlist.
  2. Query the videos endpoint directly using those IDs to fetch comprehensive details.

Key Changes

  • Updated Logic: channel_videos.py now chains requests to properly fetch data from the videos resource.
  • New Attributes: Added support for the following requested fields:
    • statistics: view_count, like_count, comment_count, favorite_count
    • contentDetails: duration, definition, dimension, caption
    • status: upload_status, privacy_status, license, embeddable, public_stats_viewable
    • snippet: published_at (mapped correctly from publishedAt), category_id, default_language
  • Deprecation Fix: Updated to_list calls to use row_type='scalar' instead of the deprecated flatten=True parameter.
  • Documentation: Updated examples/channel_videos.sql to demonstrate the usage of the new fields.
  • Please do ignore the ✓ in the code !! Used for verification (file_name: test_lib.py)
  • In channels_videos.py changed from flatten to row_type and set it as scalar (mitigated multiple warnings)

Verification

  • Added a new E2E test test_builtin_channel_videos_with_enhanced_attributes in tests/e2e/test_lib.py.
  • Test Result: Verified locally; the test passed and successfully retrieved attributes (e.g., view counts) for 6,900+ videos from the test channel.

@Harishankar14 Harishankar14 changed the title feat(youtube-data-api): add video resource attributes to builtin.channelVideos (#201) [youtube-data-api]: add video resource attributes to builtin.channelVideos (#201) Dec 5, 2025
@AndreyMarkinPPC AndreyMarkinPPC added the enhancement New feature or request label Dec 9, 2025
@AndreyMarkinPPC AndreyMarkinPPC merged commit 0bc9e27 into google:main Dec 9, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[youtube-data-api] Add support for video resource attributes in builtin.channelVideos resource

2 participants