Skip to main content

A command-line tool to search and listen to YouTube audio

Project description

ytlisten

ytlisten is a command-line based YouTube audio player that allows you to search and play YouTube videos as audio. This is a Python application that uses the YouTube API to search for and retrieve videos and uses the VLC media player to play the audio.

Installation

  1. Install the VLC app

    # Linux
    sudo apt-get install vlc # Linux
    
    # Mac
    brew install vlc
    

    Before installing ytlisten, you must first install the VLC media player. You can download it from the official VLC website at https://www.videolan.org/vlc/#download. Make sure to install the version that corresponds to your operating system.

  2. Get a YouTube API Key from Google:

  • Go to the Google Developers Console.

  • Create a new project.

  • In the left sidebar, click on "APIs & Services" and then "Library".

  • Search for "YouTube Data API v3" and click on it.

  • Click the "Enable" button.

  • In the left sidebar, click on "Credentials".

  • Click the "Create credentials" button and select "API key".

  • Copy the generated API key.

  • In your terminal, create a new environment variable called YT_API_KEY and set its value to your API key:

    export YT_API_KEY="YOUR_API_KEY_HERE"
    
  1. Install ylisten using pip

    pip install ylisten
    

Usage

Once installed, you can use the ytlisten command to search for and play audio tracks from Youtube. Here's an example:

ytlisten despacito

This will search Youtube for the keyword "despacito" and play the audio from the first video in the search results. You can also specify a Youtube video URL directly:

ytlisten https://www.youtube.com/watch?v=kJQP7kiw5Fk

That's it! You should now be able to run ytlisten and search for and listen to YouTube videos from the command line.

Limitations

Please note that ytlisten is not an official YouTube client and is not affiliated with YouTube in any way. It's a simple command-line tool that uses the YouTube Data API to search for and play YouTube videos as audio files.

Also, keep in mind that the YouTube Data API has certain usage limits and quota restrictions. If you exceed these limits, your API key may be temporarily or permanently blocked by Google. Please refer to the official documentation for more information.

Contributions / Development

Contributions are welcome!

python setup.py sdist bdist_wheel
# https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#create-an-account
twine upload dist/*

License

MIT License

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

ytlisten-0.24.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

ytlisten-0.24-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file ytlisten-0.24.tar.gz.

File metadata

  • Download URL: ytlisten-0.24.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for ytlisten-0.24.tar.gz
Algorithm Hash digest
SHA256 58f0467c88c6ef48852dc562e73070e166ac20d619f4f048be3a01809e49952c
MD5 d28f23bc2057c1d92e7b44241bee3346
BLAKE2b-256 bbc00f9d80d42c20a189fdb1b7e92bb429667b5d3d8196b86a83f1946955720b

See more details on using hashes here.

File details

Details for the file ytlisten-0.24-py3-none-any.whl.

File metadata

  • Download URL: ytlisten-0.24-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.12

File hashes

Hashes for ytlisten-0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 7c83df234f52328ae5debfb1ea0d964861cc76a76e80f899e188056aea3c2777
MD5 b29238d58a1f4f561a444d0753c50273
BLAKE2b-256 2780a3ca3df610752c2330871be780fe1e473e9bdfe77d4996c047e73208f94c

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