Skip to main content

The YouTube Music search scraper for the Python programming language.

Project description

YouTube Music API

An unofficial YouTube Music search API

Installation

  1. Python 3.9 or later is required.
  2. make sure that the latest pip version is installed in your working environment.
pip install -U pip
  1. Run the following command given below to install the package:
pip install -U YouTubeMusicAPI

Usage

To use this package, you need to import it in your Python program and call the search function with a query string as an argument. The function will return a dictionary object with the following keys:

  • title: The title of the song.
  • id: The id of the song on YouTube Music.
  • url: The url of the song on YouTube Music.
  • artwork: The url of the artwork image of the song.
  • author: A dictionary object with two keys: name and url, which represent the name and url of the author of the song.

If no result is found for your query, the function will return None.

Example

Here is an example of how to use this package to search by song name.

import YouTubeMusicAPI

query: str = "alan walker faded"

result = YouTubeMusicAPI.search(query)

if result:
    print(result)
else:
    print("No Result Found")

Output:

{
    "title": "Alan Walker - Faded",
    "id": "60ItHLz5WEA",
    "url": "https://music.youtube.com/watch?v=60ItHLz5WEA",
    "artwork": "https://img.youtube.com/vi/60ItHLz5WEA/0.jpg",
    "author": {
        "name": "Alan Walker",
        "url": "https://www.youtube.com/@Alanwalkermusic"
    }
}

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

YouTubeMusicAPI-2.8.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

YouTubeMusicAPI-2.8-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

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