YouTube Module Not Getting All Videos

Hello,

I have created multiple Scenarios that starts with the YouTube module, pulls in videos from the channel, and then creates them as a blog post. All of the scenarios have a very similar setup, but connect to different YouTube channels.

One of the scenarios is not getting all of the channel videos. It will only pull in video as far back as 2014. Other very similar scenarios I have created pull in videos all the way back to 2006.

The other issue is the channel is missing a huge chunk of videos after March 2023 and jumping straight to January 2025.

I have confirmed this channel has videos older than 2014 and videos after March 2023.
I have also tried creating a new version of the scenario from scratch. There is only one YouTube channel giving me this issue.

What could be causing this lapse in getting data?

Thank you in advance.

1 Like

Hi @rewarden and welcome to the Make Community!

Is it possible that your videos are private? Or maybe unlisted?

You can check if the problem is Make or your channel by using Python to call the YouTube API on that channel and see what you get back. If you get all the results with a direct API call, then there may be a problem with the YouTube module. If you don’t get all the results, then there’s somethign funky in that channel, compared to others.

L

Hello @L_Duperval,

Thank you for your reply. Yes, I have confirmed none of the videos are private or unlisted.

Unfortunately, I do not know how to use Python to call the YouTube API on the channel to see if it’s a problem with the YouTube module.

1 Like

Google has a bunch of sample script here:

One of them is myuploads.py which probably does what you want.

I was going to test it but realized it needed an OAuth setup for my YouTube account, which I don’t have set up.

To run it, you would probably only need to install python and run (after modifying the appropriate values in the script)

pip install --upgrade google-api-python-client
pip install --upgrade google-auth google-auth-oauthlib google-auth-httplib2
python myuploads.py

If you can’t get it to work and run into errors, give the errors to ChatGPT and ask how to correct them.

If not, let me know. I’ll try to get it working on my end and give you a clean script if needed. But normally, since the script comes from Google, it should work.

L

Here is a script that worked for me.

import requests
import json
from datetime import datetime

# Replace with your own API key
API_KEY = "YOUR_YOUTUBE_API_KEY"
YOUR_CHANNEL_ID = "NOT_THE_ONE_WITH_THE_@_SIGN"

from googleapiclient.discovery import build

# Create a YouTube API client
youtube = build('youtube', 'v3', developerKey=API_KEY)

def get_channel_uploads(channel_id):
    # Get the uploads playlist ID
    channel_response = youtube.channels().list(
        part='contentDetails',
        id=channel_id
    ).execute()
    
    uploads_playlist_id = channel_response['items'][0]['contentDetails']['relatedPlaylists']['uploads']
    
    # Retrieve videos from the uploads playlist
    videos = []
    next_page_token = None
    
    while True:
        playlist_response = youtube.playlistItems().list(
            part='snippet',
            playlistId=uploads_playlist_id,
            maxResults=50,
            pageToken=next_page_token
        ).execute()
        
        videos.extend(playlist_response['items'])
        next_page_token = playlist_response.get('nextPageToken')
        
        if not next_page_token:
            break
    
    return videos

# Example usage
channel_id = YOUR_CHANNEL_ID 
uploaded_videos = get_channel_uploads(channel_id)

# Print video titles
for video in uploaded_videos:
    # print(video['snippet']['title'])
    published_at = datetime.fromisoformat(video['snippet']['publishedAt'].replace('Z', '+00:00'))
    formatted_date = published_at.strftime('%Y-%m-%d')
    print(f"{formatted_date}: {video['snippet']['title']}")