List All Videos On A Youtube Channel Official
Limitation: Tedious for channels with hundreds of videos.
Simulates scrolling and scrapes data. Use when API is overkill or blocked.
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome()
driver.get("https://www.youtube.com/@ChannelHandle/videos")
last_height = driver.execute_script("return document.documentElement.scrollHeight")
while True:
driver.execute_script("window.scrollTo(0, document.documentElement.scrollHeight);")
time.sleep(3)
new_height = driver.execute_script("return document.documentElement.scrollHeight")
if new_height == last_height:
break
last_height = new_height list all videos on a youtube channel
YouTube API returns max 50 per page; you must paginate (shown in Python example).
Tools like youtube-dl (now yt-dlp) can list all videos without downloading:
yt-dlp --flat-playlist --print "%(title)s %(webpage_url)s" "https://www.youtube.com/@ChannelHandle"
This is fast and uses no API key (scrapes internally). Outputs titles + URLs. Limitation: Tedious for channels with hundreds of videos
The API cannot return all videos in one go. You must loop through "pages." You can run the following Python script (install pip install google-api-python-client first):
import os
import csv
from googleapiclient.discovery import build
videos = []
next_page_token = None
while True:
playlist_url = f"https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=uploads_playlist_id&maxResults=50&key=API_KEY"
if next_page_token:
playlist_url += f"&pageToken=next_page_token"
data = requests.get(playlist_url).json()
for item in data["items"]:
video_id = item["snippet"]["resourceId"]["videoId"]
title = item["snippet"]["title"]
published_at = item["snippet"]["publishedAt"]
videos.append("title": title, "url": f"https://youtube.com/watch?v=video_id", "published": published_at)
next_page_token = data.get("nextPageToken")
if not next_page_token:
break Simulates scrolling and scrapes data
print(f"Found len(videos) videos")
for v in videos[:5]:
print(v["title"], v["url"])
Pros: Full metadata, handles 10,000+ videos, fast.
Cons: Needs coding, API quota (10,000 units/day — ~200 channels with 50 videos each).