How to list a YouTube channel's videos in Python
Checked on 2026-11-18.
Four routes lead to the list of a channel's videos. They differ in how far back they go: the latest 15, the latest 30, or everything the channel ever uploaded.
1. The RSS feed: the latest 15, free
Every channel has a public feed with its 15 most recent uploads. It needs no key and no library beyond the standard one, and each entry carries a view count.
import requests
import xml.etree.ElementTree as ET
ns = {
"atom": "http://www.w3.org/2005/Atom",
"yt": "http://www.youtube.com/xml/schemas/2015",
"media": "http://search.yahoo.com/mrss/",
}
feed = requests.get(
"https://www.youtube.com/feeds/videos.xml",
params={"channel_id": "UCBJycsmduvYEL83R_U4JriQ"},
timeout=30,
)
for entry in ET.fromstring(feed.content).findall("atom:entry", ns):
views = entry.find("media:group/media:community/media:statistics", ns)
print(
entry.find("yt:videoId", ns).text,
entry.find("atom:published", ns).text,
views.get("views") if views is not None else None,
entry.find("atom:title", ns).text,
)The feed wants the channel ID, the one that starts with UC, not the handle. The guide on finding a channel ID shows how to get it. It is a good fit for checking a channel for new uploads.
2. The official API: every video
Every channel has an "uploads" playlist that holds all its public videos. Two cheap calls reach it: channels.list gives the playlist ID, and playlistItems.list pages through it 50 videos at a time. Each call costs 1 quota unit, so even a channel with thousands of videos stays far inside the daily 10,000.
import os
import requests
API = "https://www.googleapis.com/youtube/v3"
key = os.environ["YOUTUBE_API_KEY"]
channel = requests.get(f"{API}/channels", params={"part": "contentDetails", "forHandle": "@mkbhd", "key": key}, timeout=30).json()
uploads = channel["items"][0]["contentDetails"]["relatedPlaylists"]["uploads"]
params = {"part": "snippet", "playlistId": uploads, "maxResults": 50, "key": key}
while True:
page = requests.get(f"{API}/playlistItems", params=params, timeout=30).json()
for item in page["items"]:
print(item["snippet"]["resourceId"]["videoId"], item["snippet"]["publishedAt"], item["snippet"]["title"])
if "nextPageToken" not in page:
break
params["pageToken"] = page["nextPageToken"]The playlist items do not include view counts or durations. For those, pass the video IDs to videos.list in a further call.
3. yt-dlp: every video, no key
yt-dlp --flat-playlist --dump-json "https://www.youtube.com/@mkbhd/videos"It prints one JSON object per video and accepts the handle directly. --flat-playlist lists the videos without opening each one, so it is quick, and some fields can be missing. From cloud servers YouTube often refuses these requests.
4. An HTTP API: the latest 30 with their numbers
With Pipefetch one request takes a handle, a channel ID or a channel URL and returns the channel's details plus its latest uploads, each with views and duration.
import os
import requests
res = requests.get(
"https://pipefetch.com/v1/youtube/channel/videos",
params={"channel": "@mkbhd", "limit": 30},
headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
timeout=90,
)
res.raise_for_status()
data = res.json()["data"]
print(data["channel"]["title"], data["channel"]["subscriberCount"], "subscribers")
for video in data["videos"]:
print(video["publishedAt"], video["viewCount"], video["durationSeconds"], video["title"])One limit to know: it returns the latest 30 uploads and no further pages, so it is for keeping up with channels, not for a channel's whole history. View counts in the list are the rounded ones YouTube shows there; viewCountIsExact says which kind you got. A request costs 1 credit. See the reference.
Which one should you use?
| You need | Use |
|---|---|
| To notice new uploads of channels whose IDs you know | The RSS feed |
| Every video a channel ever uploaded | The official API, or yt-dlp on your own computer |
| The latest uploads with views and durations in one request, from a handle, on a server | An HTTP API such as Pipefetch |
Try it with 100 free credits. No card, no Google Cloud project, no OAuth. Get an API key or read the docs.
APIs used in this guide
-
1 credit
YouTube Channel API
Subscribers, video count, description, keywords and avatar for a channel, from a handle, id or URL.
GET /v1/youtube/channel -
1 credit
YouTube Channel Videos API
The latest uploads of a channel, newest first, with views, duration and publish time.
GET /v1/youtube/channel/videos
More guides
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to summarize a YouTube video with an LLM in Python