Commit graph

743 commits

Author SHA1 Message Date
Goldenfreddy0703
43971eb7d5 Add iOS support for browsing, charts, explore, and library
Introduces iOS-specific parsing logic for album, chart, explore, and playlist responses, including new elementRenderer formats and fallback handling for song metadata. Adds detection and parsing for iOS response structures in browsing, charts, explore, and library mixins, and creates a dedicated ios_explore parser module. Also improves continuation handling for iOS playlist responses and ensures authentication checks for saved playlists.
2025-09-08 00:19:06 -04:00
Goldenfreddy0703
2d91d248a5 feat: Add comprehensive iOS compatibility for all major function categories
- Enhanced all library, playlist, podcast, upload, browsing, and search functions
- Added iOS single-column format parsing with desktop fallbacks
- Updated client configuration to IOS_MUSIC for better OAuth compatibility
- Implemented format detection and conversion strategies
- Maintained 100% backward compatibility with existing desktop functionality
- Achieved universal client support across 30+ functions with 100% success rate

Key Changes:
- Client config: Updated default from WEB_REMIX to IOS_MUSIC (v6.42)
- Library functions: 9/9 iOS compatible with advanced parsing
- Playlist functions: All iOS compatible with single-column support
- Podcast functions: 5/5 iOS compatible with fallback strategies
- Upload functions: 7/7 iOS compatible with diverse approaches
- Browsing functions: Enhanced navigation for iOS elementRenderer structures
- Search functions: iOS format parsing for musicListItemShelfModel

Technical Implementation:
- iOS format detection via singleColumnBrowseResultsRenderer
- Navigation path enhancements for mobile vs desktop
- Format conversion from musicTwoColumnItemRenderer to standard structures
- Comprehensive fallback hierarchy for robust error handling
- Enhanced parsers with iOS-specific logic while preserving existing code

This enables seamless operation with YouTube Music's mobile clients
while maintaining full compatibility with desktop applications.
2025-09-07 00:25:40 -04:00
Solomon
e9096bf339
get_playlist/get_episodes_playlist: fix metadata (#809)
- `get_playlist` (non-audio) returns `author`

- `get_episodes_playlist` parses `description` and no longer returns
`year` as the author name:

```diff
- "description": null,
- "author": {
-   "name": "2025",
-   "id": null
- },
+ "author": {
+   "name": "Authed User",
+   "id": "..."
+ },
+ "description": "The newest episodes from all your saved podcasts",
+ "year": "2025",
```

- `get_artist_albums` and `get_playlist` (non-audio) no longer return
`"artists": []`
2025-08-30 21:30:28 +02:00
sigma67
a8e2041de8
fix flaky test (#810) 2025-08-30 21:30:19 +02:00
Alex Pastel
3618861a07
don't throw an error if playlist title is missing (fixes #805) (#808) 2025-08-26 19:50:06 +02:00
Solomon
c33d4cc64e
get_home: parse recommended channels (#807)
Handle channel links in `parse_mixed_content`:

```diff
[
  {
    "title": "Channels you may like",
    "contents": [
-     None
+     {
+       "title": "MTV UK",
+       "browseId": "UCuwUfM8E79h2sqp34Fut6kw",
+       "subscribers": "2.32M",
+       "thumbnails": [...]
+     }
```
2025-08-26 13:09:10 +02:00
Solomon
e738b2a70f
get_home: fix song artist parsing (#798)
* get_home: fix song artist parsing

extra text is now excluded from `artists`:

- `get_home`/`get_song_related`: play counts in certain track carousels
- `get_home`: "Song" specifiers for audio tracks

`get_explore` song charts are also no longer missing `album` data

* skip type specifiers in parse_song_runs without comparing text
2025-08-23 19:21:54 +02:00
DJ Sweder
0b7daa4959
Added translation for Czech language (#803)
* Create base.po

Added czech language

* added *.mo file for czech language

* Update constants.py

Added "cz" to SUPPORTED_LANGUAGES

* Update constants.py

* Create LC_MESSAGES for language "cs"

* Delete ytmusicapi/locales/cs/LC_MESSAGES

* Create base.po

* Update base.po

* Add files via upload

* Delete ytmusicapi/locales/cz/LC_MESSAGES directory
2025-08-22 15:33:58 +02:00
dependabot[bot]
d4f7cb4de8
Bump actions/checkout from 4 to 5 (#801)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-18 17:14:16 +02:00
sigma67
b4507be23b
add fallback for #799 (#800) 2025-08-17 08:45:58 +02:00
Solomon
f6295e50be
fix get_charts, add get_explore (#797)
* get_charts: move to a new class

* get_charts: update

* get_explore: init
2025-07-31 19:20:51 +02:00
Solomon
7f42e8d5f0
get_album: distinguish between "other versions" and "releases for you" (#791)
* parse_album: return audioPlaylistId for Premium users

`audioPlaylistId` is no longer `None` when `parse_album` is called with
data from a Premium account

* get_album: distinguish between "other versions" and "releases for you"

adds `related_recommendations`, a list of albums in "Releases for you"

`other_versions` no longer contains those recommendations when its
carousel is positioned after "Releases for you"
2025-07-29 22:35:21 +02:00
Solomon Victorino
59b3ca5643 search: fix episode parsing
- `parse_top_result`: handle episode data
- `parse_search_result`: ensure `resultType` is "episode", not "video"
- `parse_search_result`: offset runs to skip the "Episode" specifier
2025-07-28 18:17:13 +02:00
Solomon
39a480eace
prevent KeyError when parsing missing author data (#788)
`get_album` no longer errors on albums with no artist metadata, instead
returning `"artist": None`

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2025-07-24 21:31:49 +02:00
Haven Hamelin
ccd281ce29 Added a space between verification_url and comma
This fixes the situation in which the user ctrl + left clicks on the link in their terminal, and the comma is included as part of the code (which does not work).
2025-07-24 21:25:16 +02:00
sigma67
4506c7eb12 get_episode: fixed a crash for podcasts with missing description 2025-07-24 21:22:22 +02:00
Solomon Victorino
3f27d9bd07 update a couple tests
- replace deleted albums
- `MPREb_TPH4WqN5pUo`'s unavailable tracks are now in the tracklist
- handle podcast episodes in video results
2025-07-24 20:43:41 +02:00
sigma67
445833f420
Update bug_report.md 2025-05-22 21:18:37 +02:00
sigma67
459bc40e4c
Update README.rst 2025-04-27 09:53:40 +02:00
sigma67
14a575e168
fix typo 2025-04-17 16:38:36 +02:00
sigma67
eee75763b2
fix coverage.yml 2025-04-17 16:32:03 +02:00
sigma67
a979691bb0
>=3.10 strict typing (#765)
* >=3.10 

* fully typed (mypy strict mode enabled)

* fix tests (get_tasteprofile now requires auth - serverside)

* update linters

* fix uploads search
2025-04-17 16:05:34 +02:00
katia-sentry
03acc6ecff Enable basic Codecov Test Analytics with JUnit XML upload 2025-04-14 09:58:17 +02:00
sigma67
2bd7982a5d fix #758 2025-04-03 11:01:12 +02:00
Fabian Wunsch
f59a1b5dfd
Fix singles being renamed to "Singles & EPs" (#755)
* Fix singles being renamed to "Singles & EPs"

* add translation strings for "singles & eps"

* Remove old translation strings

---------

Co-authored-by: Solomon Victorino <git@solomonvictorino.com>
2025-03-31 22:18:14 +02:00
FireTime
e718643294
Update oauth.rst (#756)
missing parentheses
2025-03-30 19:53:05 +02:00
Stefano Borsatto
55b362e4dc
fix #751: parse_video returns always a video ID or None (#752) 2025-03-24 18:52:37 +01:00
sigma67
5e3bc62620
fix #743: get_album() now returns None for 'audioPlaylistId' (#744)
* fix #743: get_album() now returns None for 'audioPlaylistId'

* backwards compatibility
2025-03-05 21:48:06 +01:00
sigma67
c60950a2f4 simplified solution 2025-02-04 22:04:07 +01:00
Antonio Rojas
dfbcbcda7c Fix docs build
Make needs tabs, not spaces
2025-02-03 15:26:10 +01:00
sigma67
334798f68a
fix get_playlist continuations (#736)
* fix get_playlist continuations

* fix impl
2025-02-02 16:19:00 +01:00
sigma67
535f153f36
improve OAuthCredentials import ease of use (#732)
* improve OAuthCredentials import ease of use

* improve OAuthCredentials import ease of use
2025-01-31 16:14:06 +01:00
sigma67
a004bed436
refactor YTMusicBase, improve oauth doc (#727)
* refactor YTMusicBase, improve oauth doc

* fix recursion issue

* fix bugs, fix coverage, add session test
2025-01-19 14:37:31 +01:00
sigma67
af04fa4ac0
Fix 720 (#726)
* update dev-dependencies

* fix INP001

* rework docs (closes #720)

* update .readthedocs.yml
2025-01-17 20:17:04 +01:00
sigma67
e41e1a37d7
Fix 721 (#725)
* update dev-dependencies

* fix INP001

* fix #721

* add test

* format
2025-01-17 18:56:07 +01:00
sigma67
862f507e82 cli: add setup type, require version action 2025-01-17 08:56:14 +01:00
sigma67
452b5cdf6e
fix #713: get_artist radioId and shuffleId missing (#714)
* fix #713: get_artist radioId and shuffleId missing

* format
2025-01-08 08:48:07 +01:00
Solomon Victorino
3bd3da1bac get_playlist: support audio playlists 2024-12-28 23:09:26 +01:00
sigma67
e1ca551342
fix #703 (#704) 2024-12-27 20:02:16 +01:00
Solomon Victorino
338d63c9d7 search: exclude "Single"/"EP" text from album artist list
```diff
 next(r for r in yt.search("Eminem Houdini", filter="albums") if r["title"] == "Houdini")["artists"]

 [
-    {'name': 'Single', 'id': None},
     {'name': 'Eminem', 'id': 'UCedvOgsKFzcK3hA5taf3KoQ'}
 ]
```
2024-12-27 18:26:13 +01:00
Alex Pastel
4081404b56
fix(setup): Use resolve() before invoking as_uri() (#700)
If a relative file path is provided, `as_uri()` throws a ValueError.
Resolve the path to be absolute before converting to URI.
2024-12-27 18:15:58 +01:00
sigma67
0042e7d108 always upload coverage 2024-12-19 17:10:16 +01:00
sigma67
f7574237be add test analytics 2024-12-19 16:56:10 +01:00
sigma67
cdd4e38a57
update oauth docs and request interactive input instead of aborting (#694)
* update oauth docs and request interactive input instead of aborting

* move input inside oauth path, improve filename output

* update oauth.rst
2024-12-17 22:35:28 +01:00
sigma67
df1c3bdd5b feat: #670 get_podcast get_episode thumbnails 2024-12-17 22:23:29 +01:00
sigma67
b86654fbaf
Added Lyrics w. Timestamps #662 (#693)
* Added Lyrics w. Timestamps

Added `get_lyrics_with_timestamps` to get lyrics with timestamps.
The Method doesn't try to parse the response as normal lyrics, if no lyrics with timestamps are returned. (could be changed to do so tho, the format is the same)

* Update browsing.py

* Combined both get_lyrics methods into one and fixed some typechecking errors

* Fixed a missing hasTimestamps and added the doccomments to the overloads, because vscode didn't show them otherwise

* Removed the old get_lyrics_with_timestamps method

because idk where it came from...

* fixed remaining issues

* Update uploads.py

reverted some changes that I moved to an extra PR

* removed variable `context` from the Mixin, as it's use was replaced by `yt.as_mobile()`

* fix some formatting complaints by ruff and mypy

* please the linter

* fix union syntax

* improve typing in ytmusic.py

* improve typing

* replace docsbuild.yml with RTD

---------

Co-authored-by: Hendrik Horstmann <65970327+heinrich26@users.noreply.github.com>
Co-authored-by: henrich26 <hendrik-horstmann@o2mail.de>
2024-12-17 22:12:06 +01:00
Hendrik Horstmann
bb4bf4d3e1
Docstring cleanup (#665)
* Cleaned up docstrings

* cleaned up more

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-12-17 21:35:44 +01:00
Solomon
74411149d4
get_playlist: join multiple title runs (#667)
* Return complete titles when split on time-like strings:

```diff
>>> yt.get_playlist("PLaZPMsuQNCsWn0iVMtGbaUXO6z-EdZaZm")["title"]
-03 Jan
+03 Jan 12:09
```

* `test_get_playlist`: assert more props have the expected value/shape

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-12-17 21:20:33 +01:00
Corentin Marquet
1f14332eb4
search: adds functionality to remove search suggestion (#678)
* search: adds functionality to remove search history suggestion

* Minor improvements for remove search suggestions

* fix lint

* some improvements: remove_search_suggestions

* make indices optional

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-12-17 20:01:11 +01:00
sigma67
db732f29b9 fix #675 2024-12-17 18:28:14 +01:00