Skip to main content

A Python package for searching and retrieving YouTube data using kaaltube.

Project description

YouTube Data Extraction with kaaltube

Features

  • Search YouTube for videos, channels, and playlists
  • Retrieve video information and available formats
  • Extract comments from videos
  • Get video transcripts in different languages
  • Fetch search suggestions from YouTube
  • Retrieve details of YouTube channels and their playlists

Installation

Make sure you have Python installed (>=3.8). Install kaaltube using:

pip install kaaltube

Usage

The script uses asyncio to execute YouTube queries asynchronously. Below is an overview of the main functions:

Search YouTube

from kaaltube import Search

_search = Search('NoCopyrightSounds', limit=1, language='en', region='US')
result = await _search.next()
print(result)

Search for Videos Only

from kaaltube import VideosSearch

videosSearch = VideosSearch('NoCopyrightSounds', limit=10, language='en', region='US')
videosResult = await videosSearch.next()
print(videosResult)

Search for Channels Only

from kaaltube import ChannelsSearch

channelsSearch = ChannelsSearch('NoCopyrightSounds', limit=1, language='en', region='US')
channelsResult = await channelsSearch.next()
print(channelsResult)

Search for Playlists Only

from kaaltube import PlaylistsSearch

playlistsSearch = PlaylistsSearch('NoCopyrightSounds', limit=1, language='en', region='US')
playlistsResult = await playlistsSearch.next()
print(playlistsResult)

Get Video Details

from kaaltube import Video

video = await Video.get('z0GKGpObgPY')
print(video)

Get Playlist Details

from kaaltube import Playlist

playlist = await Playlist.get('https://www.youtube.com/playlist?list=PLRBp0Fe2GpgmsW46rJyudVFlY6IYjFBIK')
print(playlist)

Fetch Comments from a Video

from kaaltube import Comments

comments = Comments('_ZdsmLgCVdU')
await comments.getNextComments()
print(len(comments.comments['result']))

Retrieve Video Transcript

from kaaltube import Transcript

transcript = await Transcript.get('https://www.youtube.com/watch?v=L7kF4MXXCoA')
print(transcript)

Get YouTube Search Suggestions

from kaaltube import Suggestions

suggestions = await Suggestions.get('NoCopyrightSounds', language='en', region='US')
print(suggestions)

Running the Script

To run the script, execute:

python script.py

Ensure asyncio.run(main()) is at the end of the script to handle async execution.

Notes

  • The script uses asyncio for efficient asynchronous operations.
  • Some operations may require multiple calls to retrieve all available data (e.g., pagination for comments and playlists).
  • kaaltube provides various search filters to refine results, such as sorting by upload date or filtering by duration.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Credits

This project is based on youtube-search-python by Alex Mercer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaaltube-1.0.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaaltube-1.0.0-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file kaaltube-1.0.0.tar.gz.

File metadata

  • Download URL: kaaltube-1.0.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for kaaltube-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2e88446b0b49ae95d9101e68974dca04af4fd703313937aa4cf52b940518d543
MD5 46180f4bcfe0effa90f85ee33c57cb75
BLAKE2b-256 4ca7507ecf0b119c34f1e200375ca9f67aa5ea8705d1828a7271f1352dda0d7c

See more details on using hashes here.

File details

Details for the file kaaltube-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kaaltube-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 46.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for kaaltube-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe8cd9229d50a14930eed266c654f1e2a5c747a766726264064ca994c936e92
MD5 20d61180fead555816474521c1b7aa37
BLAKE2b-256 6a1d73e0f89fc36e2fecc929822b3185eb869cbedd488b880422840ddd64cefc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page