parent
338d63c9d7
commit
e1ca551342
18 changed files with 147 additions and 102 deletions
3
docs/source/_static/style.css
Normal file
3
docs/source/_static/style.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.wy-nav-content {
|
||||
max-width: 1080px !important;
|
||||
}
|
||||
4
docs/source/_templates/layout.html
Normal file
4
docs/source/_templates/layout.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{% extends "!layout.html" %}
|
||||
{% block extrahead %}
|
||||
<link _statichref="{{ pathto("/style.css", True) }}" rel="stylesheet" type="text/css">
|
||||
{% endblock %}
|
||||
|
|
@ -23,7 +23,7 @@ on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
|||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = "ytmusicapi"
|
||||
copyright = "2022, sigma67"
|
||||
copyright = "2024, sigma67"
|
||||
author = "sigma67"
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
|
|
@ -47,6 +47,11 @@ master_doc = "index"
|
|||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ["_templates"]
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ["_static"]
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ My library results are empty even though I set up my cookie correctly.
|
|||
Please make sure that you don't have multiple Google accounts. ``ytmusicapi`` might be returning
|
||||
results from a different account which is currently empty. You can set your account using ``X-Goog-AuthUser``
|
||||
in your headers file (numeric index) or by providing the id of a brand account with ``ytmusic = YTMusic(headers, "1234..")``.
|
||||
For more details see the :doc:`reference`.
|
||||
For more details see the :doc:`reference/index`.
|
||||
|
||||
Usage
|
||||
-----------------------
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ To achieve this, it emulates web requests that would occur if you performed the
|
|||
|
||||
To **get started**, read the :doc:`setup instructions <setup/index>`.
|
||||
|
||||
For a **complete documentation** of available functions, see the :doc:`Reference <reference>`.
|
||||
For a **complete documentation** of available functions, see the :doc:`Reference <reference/index>`.
|
||||
|
||||
Contents
|
||||
--------
|
||||
|
|
@ -26,5 +26,5 @@ Contents
|
|||
|
||||
setup/index
|
||||
usage
|
||||
reference
|
||||
reference/index
|
||||
faq
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
Reference
|
||||
==================
|
||||
|
||||
Reference for the YTMusic class.
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. autoclass:: YTMusic
|
||||
.. automethod:: YTMusic.__init__
|
||||
|
||||
|
||||
Setup
|
||||
-----
|
||||
See also the :doc:`Setup <setup/index>` page
|
||||
|
||||
.. autofunction:: setup
|
||||
.. autofunction:: setup_oauth
|
||||
|
||||
Search
|
||||
------
|
||||
.. automethod:: YTMusic.search
|
||||
.. automethod:: YTMusic.get_search_suggestions
|
||||
.. automethod:: YTMusic.remove_search_suggestions
|
||||
|
||||
|
||||
Browsing
|
||||
--------
|
||||
.. automethod:: YTMusic.get_home
|
||||
.. automethod:: YTMusic.get_artist
|
||||
.. automethod:: YTMusic.get_artist_albums
|
||||
.. automethod:: YTMusic.get_album
|
||||
.. automethod:: YTMusic.get_album_browse_id
|
||||
.. automethod:: YTMusic.get_user
|
||||
.. automethod:: YTMusic.get_user_playlists
|
||||
.. automethod:: YTMusic.get_user_videos
|
||||
.. automethod:: YTMusic.get_song
|
||||
.. automethod:: YTMusic.get_song_related
|
||||
.. automethod:: YTMusic.get_lyrics
|
||||
.. automethod:: YTMusic.get_tasteprofile
|
||||
.. automethod:: YTMusic.set_tasteprofile
|
||||
|
||||
Explore
|
||||
--------
|
||||
.. automethod:: YTMusic.get_mood_categories
|
||||
.. automethod:: YTMusic.get_mood_playlists
|
||||
.. automethod:: YTMusic.get_charts
|
||||
|
||||
Watch
|
||||
--------
|
||||
.. automethod:: YTMusic.get_watch_playlist
|
||||
|
||||
Library
|
||||
-------
|
||||
.. automethod:: YTMusic.get_library_playlists
|
||||
.. automethod:: YTMusic.get_library_songs
|
||||
.. automethod:: YTMusic.get_library_albums
|
||||
.. automethod:: YTMusic.get_library_artists
|
||||
.. automethod:: YTMusic.get_library_subscriptions
|
||||
.. automethod:: YTMusic.get_library_podcasts
|
||||
.. automethod:: YTMusic.get_library_channels
|
||||
.. automethod:: YTMusic.get_liked_songs
|
||||
.. automethod:: YTMusic.get_saved_episodes
|
||||
.. automethod:: YTMusic.get_history
|
||||
.. automethod:: YTMusic.add_history_item
|
||||
.. automethod:: YTMusic.remove_history_items
|
||||
.. automethod:: YTMusic.rate_song
|
||||
.. automethod:: YTMusic.edit_song_library_status
|
||||
.. automethod:: YTMusic.rate_playlist
|
||||
.. automethod:: YTMusic.subscribe_artists
|
||||
.. automethod:: YTMusic.unsubscribe_artists
|
||||
.. automethod:: YTMusic.get_account_info
|
||||
|
||||
Playlists
|
||||
---------
|
||||
.. automethod:: YTMusic.get_playlist
|
||||
.. automethod:: YTMusic.create_playlist
|
||||
.. automethod:: YTMusic.edit_playlist
|
||||
.. automethod:: YTMusic.delete_playlist
|
||||
.. automethod:: YTMusic.add_playlist_items
|
||||
.. automethod:: YTMusic.remove_playlist_items
|
||||
|
||||
Podcasts
|
||||
--------
|
||||
.. automethod:: YTMusic.get_channel
|
||||
.. automethod:: YTMusic.get_channel_episodes
|
||||
.. automethod:: YTMusic.get_podcast
|
||||
.. automethod:: YTMusic.get_episode
|
||||
.. automethod:: YTMusic.get_episodes_playlist
|
||||
|
||||
Uploads
|
||||
-------
|
||||
.. automethod:: YTMusic.get_library_upload_songs
|
||||
.. automethod:: YTMusic.get_library_upload_artists
|
||||
.. automethod:: YTMusic.get_library_upload_albums
|
||||
.. automethod:: YTMusic.get_library_upload_artist
|
||||
.. automethod:: YTMusic.get_library_upload_album
|
||||
.. automethod:: YTMusic.upload_song
|
||||
.. automethod:: YTMusic.delete_upload_entity
|
||||
17
docs/source/reference/browsing.rst
Normal file
17
docs/source/reference/browsing.rst
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Browsing
|
||||
--------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_home
|
||||
.. automethod:: YTMusic.get_artist
|
||||
.. automethod:: YTMusic.get_artist_albums
|
||||
.. automethod:: YTMusic.get_album
|
||||
.. automethod:: YTMusic.get_album_browse_id
|
||||
.. automethod:: YTMusic.get_user
|
||||
.. automethod:: YTMusic.get_user_playlists
|
||||
.. automethod:: YTMusic.get_user_videos
|
||||
.. automethod:: YTMusic.get_song
|
||||
.. automethod:: YTMusic.get_song_related
|
||||
.. automethod:: YTMusic.get_lyrics
|
||||
.. automethod:: YTMusic.get_tasteprofile
|
||||
.. automethod:: YTMusic.set_tasteprofile
|
||||
7
docs/source/reference/explore.rst
Normal file
7
docs/source/reference/explore.rst
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Explore
|
||||
--------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_mood_categories
|
||||
.. automethod:: YTMusic.get_mood_playlists
|
||||
.. automethod:: YTMusic.get_charts
|
||||
18
docs/source/reference/index.rst
Normal file
18
docs/source/reference/index.rst
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Reference
|
||||
=========
|
||||
|
||||
Reference for the YTMusic class.
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
ytmusic
|
||||
setup
|
||||
search
|
||||
browsing
|
||||
explore
|
||||
watch
|
||||
library
|
||||
playlists
|
||||
podcasts
|
||||
uploads
|
||||
22
docs/source/reference/library.rst
Normal file
22
docs/source/reference/library.rst
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Library
|
||||
-------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_library_playlists
|
||||
.. automethod:: YTMusic.get_library_songs
|
||||
.. automethod:: YTMusic.get_library_albums
|
||||
.. automethod:: YTMusic.get_library_artists
|
||||
.. automethod:: YTMusic.get_library_subscriptions
|
||||
.. automethod:: YTMusic.get_library_podcasts
|
||||
.. automethod:: YTMusic.get_library_channels
|
||||
.. automethod:: YTMusic.get_liked_songs
|
||||
.. automethod:: YTMusic.get_saved_episodes
|
||||
.. automethod:: YTMusic.get_history
|
||||
.. automethod:: YTMusic.add_history_item
|
||||
.. automethod:: YTMusic.remove_history_items
|
||||
.. automethod:: YTMusic.rate_song
|
||||
.. automethod:: YTMusic.edit_song_library_status
|
||||
.. automethod:: YTMusic.rate_playlist
|
||||
.. automethod:: YTMusic.subscribe_artists
|
||||
.. automethod:: YTMusic.unsubscribe_artists
|
||||
.. automethod:: YTMusic.get_account_info
|
||||
10
docs/source/reference/playlists.rst
Normal file
10
docs/source/reference/playlists.rst
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Playlists
|
||||
---------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_playlist
|
||||
.. automethod:: YTMusic.create_playlist
|
||||
.. automethod:: YTMusic.edit_playlist
|
||||
.. automethod:: YTMusic.delete_playlist
|
||||
.. automethod:: YTMusic.add_playlist_items
|
||||
.. automethod:: YTMusic.remove_playlist_items
|
||||
9
docs/source/reference/podcasts.rst
Normal file
9
docs/source/reference/podcasts.rst
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Podcasts
|
||||
--------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_channel
|
||||
.. automethod:: YTMusic.get_channel_episodes
|
||||
.. automethod:: YTMusic.get_podcast
|
||||
.. automethod:: YTMusic.get_episode
|
||||
.. automethod:: YTMusic.get_episodes_playlist
|
||||
7
docs/source/reference/search.rst
Normal file
7
docs/source/reference/search.rst
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Search
|
||||
------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.search
|
||||
.. automethod:: YTMusic.get_search_suggestions
|
||||
.. automethod:: YTMusic.remove_search_suggestions
|
||||
8
docs/source/reference/setup.rst
Normal file
8
docs/source/reference/setup.rst
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Setup
|
||||
-----
|
||||
|
||||
See also the :doc:`Setup <../setup/index>` page
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. autofunction:: setup
|
||||
.. autofunction:: setup_oauth
|
||||
11
docs/source/reference/uploads.rst
Normal file
11
docs/source/reference/uploads.rst
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Uploads
|
||||
-------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_library_upload_songs
|
||||
.. automethod:: YTMusic.get_library_upload_artists
|
||||
.. automethod:: YTMusic.get_library_upload_albums
|
||||
.. automethod:: YTMusic.get_library_upload_artist
|
||||
.. automethod:: YTMusic.get_library_upload_album
|
||||
.. automethod:: YTMusic.upload_song
|
||||
.. automethod:: YTMusic.delete_upload_entity
|
||||
5
docs/source/reference/watch.rst
Normal file
5
docs/source/reference/watch.rst
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Watch
|
||||
--------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. automethod:: YTMusic.get_watch_playlist
|
||||
6
docs/source/reference/ytmusic.rst
Normal file
6
docs/source/reference/ytmusic.rst
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
YTMusic
|
||||
-------
|
||||
|
||||
.. currentmodule:: ytmusicapi
|
||||
.. autoclass:: YTMusic
|
||||
.. automethod:: YTMusic.__init__
|
||||
|
|
@ -312,11 +312,21 @@ class LibraryMixin(MixinProtocol):
|
|||
def add_history_item(self, song):
|
||||
"""
|
||||
Add an item to the account's history using the playbackTracking URI
|
||||
obtained from :py:func:`get_song`.
|
||||
obtained from :py:func:`get_song`. A ``204`` return code indicates success.
|
||||
|
||||
Usage::
|
||||
|
||||
song = yt_auth.get_song(videoId)
|
||||
response = yt_auth.add_history_item(song)
|
||||
|
||||
.. note::
|
||||
|
||||
You need to use the same YTMusic instance as you used for :py:func:`get_song`.
|
||||
|
||||
:param song: Dictionary as returned by :py:func:`get_song`
|
||||
:return: Full response. response.status_code is 204 if successful
|
||||
"""
|
||||
self._check_auth()
|
||||
url = song["playbackTracking"]["videostatsPlaybackUrl"]["baseUrl"]
|
||||
CPNA = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
|
||||
cpn = "".join(CPNA[randint(0, 256) & 63] for _ in range(0, 16))
|
||||
|
|
|
|||
Loading…
Reference in a new issue