TubeScrape
Scrape YouTube search results, channels, transcripts, comments, and playlists. No API key needed.
Documentation · PyPI · Hosted version · Issues
- Search videos, channels, and shorts with filters: type, duration, upload date, sort order, features
- Shorts: every Short of a channel sorted by latest, popular, or oldest, a Shorts-only search, hashtag pages, and the "next Shorts" chain
- Video info with exact views and likes, comment count, publish time in UTC, chapters, AI summary, and people mentioned
- Transcripts in any available language, with translation and SRT/VTT/JSON export
- Comments with replies, like counts, and hearted/verified/creator badges
- Channels: videos, live streams, shorts, playlists, about page, and search within a channel
- Playlists with full pagination
- Sync and async API, proxy rotation, and a single dependency (
httpx) - Every method accepts URLs, IDs, or @handles interchangeably
Want it as a hosted API instead? The same engine runs as a managed Apify actor with proxies and rate limits handled for you. Call it from any language in a few lines, or use the point-and-click UI. See the hosted version below.
Install
pip install tubescrape
Quick start
from tubescrape import YouTube
yt = YouTube()
results = yt.search('python tutorial', max_results=5)
for video in results.videos:
print(video.title, video.view_count)
That's it. The sections below cover each feature one at a time.
Search
Search supports the same filters as YouTube's web interface:
yt.search('podcast', type='video', duration='long')
yt.search('news', upload_date='today', sort_by='view_count')
yt.search('music', features=['4k', 'hdr'])
yt.search('tech channels', type='channel')
yt.search('ai story', type='short')
Available filters: sort_by (relevance, upload_date, view_count, rating), upload_date (last_hour, today, this_week, this_month, this_year), type (video, short, channel, playlist, movie), duration (short, medium, long), and features (live, 4k, hd, subtitles, cc, creative_commons, 360, vr180, 3d, hdr).
Video info
Full metadata for a single video, including data the search results don't carry:
info = yt.get_video_info('https://youtube.com/watch?v=dQw4w9WgXcQ')
print(info.like_count, info.comment_count, info.ai_summary)
for chapter in info.chapters:
print(chapter.time_description, chapter.title)
like_count is YouTube's display text ('19M'). The exact number is in likes, next to is_short and publish_date_utc:
print(info.likes, info.is_short, info.publish_date_utc)
# 19512316 False 2009-10-25T06:57:33Z
To fetch many videos at once, pass IDs, URLs, or result objects to get_videos_info. Results come back in the same order, with None for any video that failed:
infos = yt.get_videos_info(['dQw4w9WgXcQ', 'jNQXAC9IVRw'], concurrency=5)
Transcripts
Fetch a transcript with one call:
transcript = yt.get_transcript('dQw4w9WgXcQ')
print(transcript.text)
Prefer a source language, or let YouTube machine-translate it:
transcript = yt.get_transcript('dQw4w9WgXcQ', languages=['es', 'en'])
transcript = yt.get_transcript('dQw4w9WgXcQ', translate_to='de')
Save as subtitles (format is inferred from the extension):
transcript.save('subtitles.srt')
transcript.save('subtitles.vtt')
Use yt.list_transcripts(video) to see which languages a video has before fetching.
Comments
Top-level comments, optionally with their replies:
comments = yt.get_comments('dQw4w9WgXcQ', max_results=10, replies=True)
for c in comments.comments:
print(c.author, c.text, c.like_count)
for r in c.replies:
print(f' -> {r.author}: {r.text}')
Each comment carries author info and hearted/verified/creator badges.
Channels
Each channel tab has its own method. All of them accept a channel ID, a full URL, or an @handle:
videos = yt.get_channel_videos('@lexfridman', max_results=10)
streams = yt.get_channel_streams('@CNN', max_results=5)
shorts = yt.get_channel_shorts('@CNN', max_results=10)
playlists = yt.get_channel_playlists('@mkbhd')
Channel metadata comes from the about page:
about = yt.get_channel_about('@ycombinator')
print(about.country, about.joined_date, about.subscriber_count)
And you can search within a single channel:
results = yt.search_channel('@lexfridman', 'machine learning')
Shorts
A channel's Shorts tab is paged in full and can be sorted:
shorts = yt.get_channel_shorts('@MrBeast') # all of them
top = yt.get_channel_shorts('@MrBeast', max_results=10, sort_by='popular')
for short in top.shorts:
print(short.title, short.view_count, short.views) # '1.9B views', 1900000000
sort_by accepts latest (default), popular, and oldest.
Find Shorts by keyword or by hashtag:
results = yt.search('ai story', type='short', max_results=40) # every result is a Short
tagged = yt.get_hashtag_shorts('#aiart') # about 36 per hashtag
YouTube lists a Short with only its title and a rounded view count. get_videos_info fills in the channel, exact views and likes, comment count, and publish time:
infos = yt.get_videos_info(top.shorts)
for info in infos:
print(info.channel, info.view_count, info.likes, info.comment_count, info.publish_date_utc)
get_related_shorts returns the Shorts YouTube plays after a given one. Each comes back with exact numbers already filled in, about nine per request:
related = yt.get_related_shorts('https://www.youtube.com/shorts/sHpEqeSByPI')
same_channel = yt.get_related_shorts(top.shorts[0]) # a listed Short stays inside its own list
A Short is also a regular video: youtube.com/shorts/ID and youtube.com/watch?v=ID are the same thing, so get_video_info, get_transcript, and get_comments all work on Shorts.
Playlists
playlist = yt.get_playlist('PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf')
for video in playlist.videos:
print(video.title)
Pagination is handled for you. Pass max_results=0 to fetch the entire playlist.
Async
Every method has an async variant with an a prefix, sharing one connection pool:
import asyncio
from tubescrape import YouTube
async def main():
yt = YouTube()
results = await yt.asearch('python tutorial', max_results=5)
transcript = await yt.aget_transcript(results.videos[0].video_id)
await yt.aclose()
asyncio.run(main())
Proxies
Pass one proxy or a rotating pool. Transcripts can use a separate pool, which is useful because YouTube rate-limits caption endpoints more aggressively:
yt = YouTube(
proxies=['http://user:pass@proxy1:8000', 'http://user:pass@proxy2:8000'],
transcript_proxies=['http://user:pass@residential:8000'],
)
CLI
pip install "tubescrape[cli]"
tubescrape search "python tutorial" -n 5
tubescrape channel @lexfridman
tubescrape transcript dQw4w9WgXcQ --format srt --save output.srt
REST API
pip install "tubescrape[api]"
tubescrape serve # localhost:8000
Swagger docs at http://localhost:8000/docs.
Hosted version: no-code or API
Don't want to manage Python, proxies, or rate limits? The same engine runs as a hosted scraper on Apify with a point-and-click UI, scheduling, and exports to JSON/CSV/Excel. It covers search, channels, Shorts, hashtags, playlists, transcripts, and comments:
YouTube Scraper with Transcripts & Comments
It is also a hosted API. Call it from code with the Apify client (pip install apify-client):
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("misterzaid.py/youtube-scraper").call(run_input={
"searchQueries": ["python tutorial"],
"maxResults": 50,
"downloadTranscripts": True,
})
items = client.dataset(run["defaultDatasetId"]).list_items().items
Proxies, retries, and YouTube's rate limits are handled server-side, and you pay per result.
How it works
Uses YouTube's internal InnerTube API (the same endpoints the YouTube web client uses). No API key, no OAuth, no Google account required. Only dependency is httpx.
Documentation
For the complete API reference, all parameters, return types, and advanced usage:
Warning
This library uses YouTube's undocumented InnerTube API. It may break if YouTube changes their internal API. If it does, please open an issue.
License
MIT
Metadata
Release files for tubescrape 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tubescrape-0.6.0.tar.gz | 2.6 MB | With provenance | Details for tubescrape-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tubescrape-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for tubescrape-0.6.0-py3-none-any.whl |
Total release size: 2.7 MB
Release files / tubescrape-0.6.0.tar.gz
| Download URL | tubescrape-0.6.0.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8eddd83549616751b6c53270336ae3be8ccd273a179a7dbc47aa13f7ac629d1
|
|
BLAKE2b-256 checksum How to use checksums |
b791351e181e3e6c18633b27a40216208ea1067263015ffdcd9cae905274ef94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logRelease files / tubescrape-0.6.0-py3-none-any.whl
| Download URL | tubescrape-0.6.0-py3-none-any.whl |
|---|---|
| Size | 73.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b336685692373551e4e6af98c5fe29afe1ae7270f17b2ca20cb9795f754b45cb
|
|
BLAKE2b-256 checksum How to use checksums |
b7552cbc115b65424906f03bb7e2a61c1a6c3d46bb41644c3a586151f539e62e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logSecurity for tubescrape 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for tubescrape-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.