Commit graph ytmusicapi/tests/mixins
Author SHA1 Message Date
sigma67
a8e2041de8
fix flaky test (#810) 2025-08-30 21:30:19 +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
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
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
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
sigma67
2bd7982a5d fix #758 2025-04-03 11:01:12 +02:00
sigma67
334798f68a
fix get_playlist continuations (#736)
* fix get_playlist continuations

* fix impl
2025-02-02 16:19:00 +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
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
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
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
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
sigma67
7ef703c213
Fix get_history (#691)
* fix get_history feedbackToken parsing

* remove broken playlist test

* skip broken tests for now
2024-12-17 12:21:04 +01:00
Abhishek M J
8f479b1b5b
Fix duration parsing for very long videos (#661)
* Fix duration parsing for very long videos sigma67#660

* parse duration only when digits are present

* explicit return None

* Add test for track dur > 1k hrs
2024-10-15 16:58:31 +02:00
fritz stelluto
2b5d19abb1
fix #656: attempt to find runs in subtitle if not in title (#657)
* fix #656: attempt to find runs in subtitle if not in title

* refactor

* remove fix by gotofritz

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-10-08 12:17:14 +02:00
sigma67
2c6c6b6504
search: fix missing playlistId for album results while authenticated (#659)
* search: fix missing playlistId for album results while authenticated

* deduplicate test
2024-10-07 20:28:56 +02:00
sigma67
e995ae56ce
search: fix missing artists when filtering songs/videos (#655)
* search: fix missing artists when filtering songs/videos

* search: fix missing artists when filtering songs/videos
2024-10-05 13:30:18 +02:00
sigma67
77e40b7f7d
refactor: use pathlib (#654)
* refactor: use pathlib

* fix size mock
2024-10-05 12:39:21 +02:00
sigma67
7d8a756638
upload_song: add error when file exceeds limit of 300MB (#653)
* upload_song: add error when file exceeds limit of 300MB (closes #647)

* fix import
2024-10-05 11:40:51 +02:00
sigma67
09ca398719
fix #642: create_playlist: raise error when invalid characters are pa… (#652)
* fix #642: create_playlist: raise error when invalid characters are part of playlist title

* add test

* fix CI helper

* fix CI helper

* adjust workflow
2024-10-05 11:31:11 +02:00
sigma67
e433b22231
fix #650: playlists without track count in metadata now return trackCount=None 2024-10-05 10:44:11 +02:00
RealCalumPlays
5478951ba3
fix(playlists): handle missing regex group in trackCount (#651)
* fix(playlists): get_playlist trackCount incorrect for playlists with more than 1k tracks

This ensures that the regex doesnt just return the first group in 1000+ long playlists.

* feat+fix(playlist_tests): Update playlist ID and add new track count test

* fix tests

---------

Co-authored-by: RealCalumPlays <calumplays666+github@gmail.com>
Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-10-05 10:33:20 +02:00
sigma67
a15d90c4f3
add get_user_videos (#632)
* add get_user_videos

* add to docs
2024-07-24 19:37:33 +02:00
sigma67
858995e016
fix search filters test 2024-07-23 21:57:12 +02:00
sigma67
0f00260f57
fix search queries test 2024-07-23 21:51:19 +02:00
sigma67
8d6dd117eb fix test broken by added podcasts on oasis page 2024-07-23 21:40:00 +02:00
czifumasa
895ebb0898 tests for tracks in collaborative playlists 2024-07-23 21:40:00 +02:00
sigma67
14ae7852ea
coverage: remove code for old playlist format (#619)
* coverage: remove temporary code for new playlist format

* fix flaky search test

* improve rate_song coverage

* test invalid order raise

* fix workflow
2024-07-13 21:18:19 +02:00
sigma67
828b1b9810
drop 3.8, add pytest-retry (#592)
* drop 3.8, add pytest-retry

* fix mypy

* fix missing import
2024-07-13 20:40:50 +02:00
JohnHKoh
08d9f3049c
Extract song count from text (#609)
* Extract song count from text

* Add fix in parsers

* add test

---------

Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-07-13 20:28:00 +02:00
sigma67
05cb3caf4a
fix some more tests 2024-07-03 22:05:50 +02:00
sigma67
c97a13e3bd
fix search test 2024-07-03 21:50:32 +02:00
Ricardo Mendonça Ferreira
11823d6387
edit_playlist(): Allow moving title to bottom of playlist (#602)
* Allow moving title to bottom of playlist

* test_edit_playlist fixed & extended

* add labeled coverage workflow run for external PRs

* add labeled coverage workflow run for external PRs

* add labeled coverage workflow run for external PRs

* add another pr target workflow

---------

Co-authored-by: Ricardo <ric.ce.br@gmail.com>
Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-06-17 18:24:39 +02:00
sigma67
0cf0883723
fix #582 (#583)
* fix #582

* fix result type heuristics
2024-05-20 21:45:02 +02:00
Alex Pastel
ae966bb96a
Gracefully retrieve uploaded songs with a blank duration (#578) (#580)
* add unit test that attempts to retrieve a song after its been uploaded

* prevent parsing errors when an uploaded song lacks a duration

* update unit test to delete/re-upload song if it already is uploaded

* format

* fix test

* add another sleep to end2end playlist

---------

Co-authored-by: sigma67 <ytmusicapi@gmail.com>
2024-05-11 18:23:11 +02:00
sigma67
614999c77d
search: fix #569 (#581)
* search: fix #569

* fix an issue with localized instances

* add test for localized search
2024-05-09 21:23:19 +02:00
sigma67
f53074e5f2
fix #562 (#573)
* fix #562

* fix test

* use correct public test data

* fix up for new format

* fix lint
2024-05-04 13:19:53 +02:00
sigma67
2217f3d92d
fix #544 (#560)
* fix #544

* fix ignores
2024-04-05 20:53:32 +02:00
sigma67
0d996030f4 get_artist: shows support 2024-03-13 20:53:08 +01:00
sigma67
f6932c2bf1
get_episodes_playlist (#561)
* get_episodes_playlist

* fix minor issues
2024-03-08 21:32:09 +01:00
sigma67
90d172b1d3
podcasts features ✨ (#559) 2024-03-06 23:02:19 +01:00