@@ -167,8 +167,8 @@ def public_playlists(
167167 ) -> List [Union ["Playlist" , "UserPlaylist" ]]:
168168 """Get the (public) playlists created by the user.
169169
170- :param limit: The index of the first item you want included .
171- :param offset: The amount of items you want returned .
170+ :param limit: The number of items you want returned .
171+ :param offset: The index of the first item you want included .
172172 :return: List of public playlists.
173173 """
174174 params = {"limit" : limit , "offset" : offset }
@@ -564,14 +564,14 @@ def artists_paginated(
564564
565565 def artists (
566566 self ,
567- limit : Optional [ int ] = None ,
567+ limit : int = 50 ,
568568 offset : int = 0 ,
569569 order : Optional [ArtistOrder ] = None ,
570570 order_direction : Optional [OrderDirection ] = None ,
571571 ) -> List ["Artist" ]:
572572 """Get the users favorite artists.
573573
574- :param limit: Optional; The amount of artists you want returned.
574+ :param limit: The number of artist you want returned.
575575 :param offset: The index of the first artist you want included.
576576 :param order: Optional; A :class:`ArtistOrder` describing the ordering type when returning the user favorite artists. eg.: "NAME, "DATE"
577577 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
@@ -625,14 +625,14 @@ def albums_paginated(
625625
626626 def albums (
627627 self ,
628- limit : Optional [ int ] = None ,
628+ limit : int = 50 ,
629629 offset : int = 0 ,
630630 order : Optional [AlbumOrder ] = None ,
631631 order_direction : Optional [OrderDirection ] = None ,
632632 ) -> List ["Album" ]:
633633 """Get the users favorite albums.
634634
635- :param limit: Optional; The amount of albums you want returned.
635+ :param limit: The number of albums you want returned.
636636 :param offset: The index of the first album you want included.
637637 :param order: Optional; A :class:`AlbumOrder` describing the ordering type when returning the user favorite albums. eg.: "NAME, "DATE"
638638 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
@@ -684,15 +684,15 @@ def playlists_paginated(
684684
685685 def playlists (
686686 self ,
687- limit : Optional [ int ] = 50 ,
687+ limit : int = 50 ,
688688 offset : int = 0 ,
689689 order : Optional [PlaylistOrder ] = None ,
690690 order_direction : Optional [OrderDirection ] = None ,
691691 ) -> List ["Playlist" ]:
692692 """Get the users favorite playlists (v2 endpoint), relative to the root folder
693693 This function is limited to 50 by TIDAL, requiring pagination.
694694
695- :param limit: Optional; The number of playlists you want returned (Note: Cannot exceed 50)
695+ :param limit: The number of playlists you want returned (Note: Cannot exceed 50)
696696 :param offset: The index of the first playlist to fetch
697697 :param order: Optional; A :class:`PlaylistOrder` describing the ordering type when returning the user favorite playlists. eg.: "NAME, "DATE"
698698 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
@@ -728,15 +728,15 @@ def playlists(
728728
729729 def playlist_folders (
730730 self ,
731- limit : Optional [ int ] = 50 ,
731+ limit : int = 50 ,
732732 offset : int = 0 ,
733733 order : Optional [PlaylistOrder ] = None ,
734734 order_direction : Optional [OrderDirection ] = None ,
735735 parent_folder_id : str = "root" ,
736736 ) -> List ["Folder" ]:
737737 """Get a list of folders created by the user.
738738
739- :param limit: Optional; The number of playlists you want returned (Note: Cannot exceed 50)
739+ :param limit: The number of playlists you want returned (Note: Cannot exceed 50)
740740 :param offset: The index of the first playlist folder to fetch
741741 :param order: Optional; A :class:`PlaylistOrder` describing the ordering type when returning the user favorite playlists. eg.: "NAME, "DATE"
742742 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
@@ -797,7 +797,7 @@ def tracks_paginated(
797797
798798 :param order: Optional; A :class:`ItemOrder` describing the ordering type when returning the user favorite tracks. eg.: "NAME, "DATE"
799799 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
800- :return: A :class:`list` :class:`~tidalapi.playlist.Playlist ` objects containing the favorite tracks.
800+ :return: A :class:`list` :class:`~tidalapi.media.Track ` objects containing the favorite tracks.
801801 """
802802 count = self .session .user .favorites .get_tracks_count ()
803803 return get_items (
@@ -806,15 +806,15 @@ def tracks_paginated(
806806
807807 def tracks (
808808 self ,
809- limit : Optional [ int ] = None ,
809+ limit : int = 50 ,
810810 offset : int = 0 ,
811811 order : Optional [ItemOrder ] = None ,
812812 order_direction : Optional [OrderDirection ] = None ,
813813 ) -> List ["Track" ]:
814814 """Get the users favorite tracks.
815815
816- :param limit: Optional; The amount of items you want returned.
817- :param offset: The index of the first item you want included.
816+ :param limit: The number of tracks you want returned.
817+ :param offset: The index of the first track you want included.
818818 :param order: Optional; A :class:`ItemOrder` describing the ordering type when returning the user favorite tracks. eg.: "NAME, "DATE"
819819 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
820820 :return: A :class:`list` of :class:`~tidalapi.media.Track` objects containing all of the favorite tracks.
@@ -847,16 +847,32 @@ def get_tracks_count(
847847 json_obj = self .requests .map_request (f"{ self .base_url } /tracks" , params = params )
848848 return json_obj .get ("totalNumberOfItems" , 0 )
849849
850+ def videos_paginated (
851+ self ,
852+ order : Optional [ItemOrder ] = None ,
853+ order_direction : Optional [OrderDirection ] = None ,
854+ ) -> List ["Video" ]:
855+ """Get the users favorite videos, using pagination.
856+
857+ :param order: Optional; A :class:`ItemOrder` describing the ordering type when returning the user items. eg.: "NAME, "DATE"
858+ :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
859+ :return: A :class:`list` :class:`~tidalapi.media.Video` objects containing the favorite videos.
860+ """
861+ count = self .session .user .favorites .get_videos_count ()
862+ return get_items (
863+ self .session .user .favorites .videos , count , order , order_direction
864+ )
865+
850866 def videos (
851867 self ,
852- limit : Optional [ int ] = None ,
868+ limit : int = 50 ,
853869 offset : int = 0 ,
854870 order : Optional [VideoOrder ] = None ,
855871 order_direction : Optional [OrderDirection ] = None ,
856872 ) -> List ["Video" ]:
857873 """Get the users favorite videos.
858874
859- :param limit: Optional; The amount of videos you want returned.
875+ :param limit: The number of videos you want returned.
860876 :param offset: The index of the first video you want included.
861877 :param order: Optional; A :class:`VideoOrder` describing the ordering type when returning the user favorite videos. eg.: "NAME, "DATE"
862878 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
@@ -877,16 +893,31 @@ def videos(
877893 ),
878894 )
879895
896+ def get_videos_count (
897+ self ,
898+ ) -> int :
899+ """Get the total number of videos in the user's collection.
900+
901+ This performs a minimal API request (limit=1) to fetch metadata about the tracks
902+ without retrieving all of them. The API response contains 'totalNumberOfItems',
903+ which represents the total items (videos) available.
904+ :return: The number of items available.
905+ """
906+ params = {"limit" : 1 , "offset" : 0 }
907+
908+ json_obj = self .requests .map_request (f"{ self .base_url } /videos" , params = params )
909+ return json_obj .get ("totalNumberOfItems" , 0 )
910+
880911 def mixes (
881912 self ,
882- limit : Optional [ int ] = 50 ,
913+ limit : int = 50 ,
883914 offset : int = 0 ,
884915 order : Optional [MixOrder ] = None ,
885916 order_direction : Optional [OrderDirection ] = None ,
886917 ) -> List ["MixV2" ]:
887918 """Get the users favorite mixes & radio.
888919
889- :param limit: Optional; The amount of mixes you want returned.
920+ :param limit: The number of mixes you want returned.
890921 :param offset: The index of the first mix you want included.
891922 :param order: Optional; A :class:`MixOrder` describing the ordering type when returning the user favorite mixes. eg.: "NAME, "DATE"
892923 :param order_direction: Optional; A :class:`OrderDirection` describing the ordering direction when sorting by `order`. eg.: "ASC", "DESC"
0 commit comments