[PR #181] [MERGED] Feature: Related Artists in get_artist and Exception for Non-Music Channels #574

Closed
opened 2026-02-27 23:01:32 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/181
Author: @tempoxylophone
Created: 3/22/2021
Status: Merged
Merged: 3/24/2021
Merged by: @sigma67

Base: masterHead: master


📝 Commits (7)

  • 5457cd8 Feature: add related artist section to BrowsingMixin get_artist method
  • 3272e1f added documentation for related artists feature
  • b1ecae3 removed named exception in favor of ValueError when non-music YouTube channel id given to get_artist. Minor changes to structure of related artists property in get_artist, added thumbnails.
  • 15bf0bb Feature: add related artist section to BrowsingMixin get_artist method
  • 27a12e6 added documentation for related artists feature
  • 8ec9b6a removed named exception in favor of ValueError when non-music YouTube channel id given to get_artist. Minor changes to structure of related artists property in get_artist, added thumbnails.
  • c40cb12 Merge branch 'master' of https://github.com/mikefreemanwd/ytmusicapi

📊 Changes

4 files changed (+60 additions, -7 deletions)

View changed files

📝 README.rst (+1 -1)
📝 tests/test.py (+16 -1)
📝 ytmusicapi/mixins/browsing.py (+33 -5)
📝 ytmusicapi/parsers/browsing.py (+10 -0)

📄 Description

In the BrowserMixin class from the mixins/browsing.py file there is a method called get_artist that returns artist information.

I made 2 modifications to get_artist:

  1. Return the related artists that appear at the bottom of the page under the "Fans might also like" section. These related artists are returned as a list of dictionaries that contain the artist name, the artist YouTube Music Channel ID, and the text that shows the approximate number of subscribers
  2. You can technically visit any YouTube channel in the YouTube music front-end. That means you can visit non-music channel IDs that will not return any YouTube music content (example: Google Developers). I created an exception called YouTubeChannelIDIsNotArtistException that is thrown when a non-music channel ID is provided to the get_artist function.

I updated the documentation for the get_artist function, added a unit test for each modification, and made sure that the pre-commit linters pass.

This can be called with:

ytmusic = YTMusic()
youtube_channel_id = "..."
return ytmusic.get_artist(youtube_channel_id)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/sigma67/ytmusicapi/pull/181 **Author:** [@tempoxylophone](https://github.com/tempoxylophone) **Created:** 3/22/2021 **Status:** ✅ Merged **Merged:** 3/24/2021 **Merged by:** [@sigma67](https://github.com/sigma67) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (7) - [`5457cd8`](https://github.com/sigma67/ytmusicapi/commit/5457cd8e11e05984e9d86ff0becb48022072611b) Feature: add related artist section to BrowsingMixin get_artist method - [`3272e1f`](https://github.com/sigma67/ytmusicapi/commit/3272e1f5230d1e9d8cfad00b680ea247b34f7e0e) added documentation for related artists feature - [`b1ecae3`](https://github.com/sigma67/ytmusicapi/commit/b1ecae3d9feb1b4d4b6e54599114a50c5c92deb5) removed named exception in favor of ValueError when non-music YouTube channel id given to get_artist. Minor changes to structure of related artists property in get_artist, added thumbnails. - [`15bf0bb`](https://github.com/sigma67/ytmusicapi/commit/15bf0bbe1b2b6719d3c9c387dae242cd40046504) Feature: add related artist section to BrowsingMixin get_artist method - [`27a12e6`](https://github.com/sigma67/ytmusicapi/commit/27a12e6765680460c61fe5c22a3ab57d50375906) added documentation for related artists feature - [`8ec9b6a`](https://github.com/sigma67/ytmusicapi/commit/8ec9b6ac41d92926067e7bf0562d762ec50c8c6c) removed named exception in favor of ValueError when non-music YouTube channel id given to get_artist. Minor changes to structure of related artists property in get_artist, added thumbnails. - [`c40cb12`](https://github.com/sigma67/ytmusicapi/commit/c40cb12b5744e10e31c38c7db37263183b46ef39) Merge branch 'master' of https://github.com/mikefreemanwd/ytmusicapi ### 📊 Changes **4 files changed** (+60 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `README.rst` (+1 -1) 📝 `tests/test.py` (+16 -1) 📝 `ytmusicapi/mixins/browsing.py` (+33 -5) 📝 `ytmusicapi/parsers/browsing.py` (+10 -0) </details> ### 📄 Description In the `BrowserMixin` class from the mixins/browsing.py file there is a method called `get_artist` that returns artist information. I made 2 modifications to `get_artist`: 1. Return the related artists that appear at the bottom of the page under the "Fans might also like" section. These related artists are returned as a list of dictionaries that contain the artist name, the artist YouTube Music Channel ID, and the text that shows the approximate number of subscribers 2. You can technically visit any YouTube channel in the YouTube music front-end. That means you can visit non-music channel IDs that will not return any YouTube music content (example: [Google Developers](https://music.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw)). I created an exception called `YouTubeChannelIDIsNotArtistException` that is thrown when a non-music channel ID is provided to the `get_artist` function. I updated the documentation for the `get_artist` function, added a unit test for each modification, and made sure that the pre-commit linters pass. This can be called with: ```python ytmusic = YTMusic() youtube_channel_id = "..." return ytmusic.get_artist(youtube_channel_id) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 23:01:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#574
No description provided.