Commit graph ytmusicapi/tests/mixins
Author SHA1 Message Date
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
Alex Pastel
c412d7ce34
Implement get_account_info() to get authenticated user's account info (#556) (#557)
* implement get_account_info to provide information about the authenticated user's account (#556)

* Apply suggestions from code review to tests/README.rst

Co-authored-by: sigma67 <16363825+sigma67@users.noreply.github.com>

* simplify get_account_info by moving code out of parsers.py and navigation.py

* test with non-auth account

* format

* update .pre-commit-config.yaml

---------

Co-authored-by: sigma67 <16363825+sigma67@users.noreply.github.com>
Co-authored-by: sigma67 <sigma67.github@gmail.com>
2024-03-03 19:55:06 +01:00
sigma67
0734595395 get_episode: support progress percentage 2024-03-01 20:49:11 +01:00
fischcode
d143480ae4
Fix parsing of album and views in parse_playlist_items (#552)
* Fix parsing of album and views in parse_playlist_items

Parse album and views columns as a function of flex column count and is_album property to cater for varying layouts with three and four flex columns

* Add "own_playlist" attribute to playlists

To allow for an easy distinction between owned / editable and community / non-editable playlists,in applications incorporating ytmusicapi, a boolean "own_playlist" dictionary entry is added to playlists based on existing code already identifying this property.

* Add thumbnails to episodes

Add thumbnails to episodes for visual rendering in Kodi etc.

* Add unit test for playlist "own_playlist" attribut

Add unit test for playlist "own_playlist" attribut

* Improvements as requested

- rename attribute for own playlists to playlist("owned")
- filter out episode thumbnails with an non-functional URL

* Fix linter in test_playlists.py

Fix test for playlist["owned"]

* Auto-Formatting on playlists.py

* format parsers/podcasts.py

* Remove filtering of podcast thumbnails

No idea why I had seen useless images for those thumbnails before - maybe Google fixed something to make them work?
2024-02-27 09:23:09 +01:00
sigma67
f237d50ab7 fix tests 2024-02-22 20:47:15 +01:00
sigma67
e1bcb88c92 Revert "get_charts: removed trending category (no longer available on YTM)"
This reverts commit da492e49f6.
2024-02-22 20:47:15 +01:00
sigma67
f98274f0ec improve coverage 2024-02-04 17:03:59 +01:00
sigma67
da492e49f6 get_charts: removed trending category (no longer available on YTM) 2024-02-04 17:03:59 +01:00
sigma67
cc26a63264 get_watch_playlist: fixed an issue when longBylineText is missing 2024-02-04 17:03:59 +01:00
sigma67
170eea358d add brand account setup script (#520) 2024-02-04 17:03:59 +01:00