Feature: add get_user, get_user_playlists
This commit is contained in:
parent
7608220ce4
commit
d842d6bde5
21 changed files with 310 additions and 146 deletions
|
|
@ -23,6 +23,8 @@ Browsing
|
|||
--------
|
||||
.. automethod:: YTMusic.get_artist
|
||||
.. automethod:: YTMusic.get_artist_albums
|
||||
.. automethod:: YTMusic.get_user
|
||||
.. automethod:: YTMusic.get_user_playlists
|
||||
.. automethod:: YTMusic.get_album
|
||||
|
||||
Library
|
||||
|
|
|
|||
|
|
@ -55,6 +55,16 @@ class TestYTMusic(unittest.TestCase):
|
|||
artist['singles']['params'])
|
||||
self.assertGreater(len(results), 0)
|
||||
|
||||
def test_get_user(self):
|
||||
results = youtube.get_user("UC44hbeRoCZVVMVg5z0FfIww")
|
||||
self.assertEqual(len(results), 3)
|
||||
|
||||
def test_get_user_playlists(self):
|
||||
results = youtube.get_user("UCPVhZsC2od1xjGhgEc2NEPQ")
|
||||
results = youtube.get_user_playlists("UCPVhZsC2od1xjGhgEc2NEPQ",
|
||||
results['playlists']['params'])
|
||||
self.assertGreater(len(results), 100)
|
||||
|
||||
def test_get_album(self):
|
||||
results = youtube_auth.get_album("MPREb_BQZvl3BFGay")
|
||||
self.assertEqual(len(results), 9)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ Copy the base template:
|
|||
Update translation
|
||||
------------------
|
||||
|
||||
``msgmerge --update locales/de/LC_MESSAGES/base.po locales/base.pot``
|
||||
``cd locales && sh update_po.sh``
|
||||
|
||||
Edit translation
|
||||
----------------
|
||||
|
|
@ -37,4 +37,4 @@ Finalize translation
|
|||
---------------------
|
||||
To generate mo files, run
|
||||
|
||||
``msgfmt -o locales/de/LC_MESSAGES/base.mo locales/de/LC_MESSAGES/base``
|
||||
``cd locales && sh update_mo.sh``
|
||||
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,34 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr ""
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr "künstler"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr "playlist"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr "titel"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr "video"
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr "album"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr "alben"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr "singles"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr "videos"
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr "playlists"
|
||||
|
||||
#~ msgid "album"
|
||||
#~ msgstr "album"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 11:52+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,31 +17,34 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:229
|
||||
#: ytmusicapi/parsers.py:232
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:229
|
||||
#: ytmusicapi/parsers.py:241
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:224
|
||||
#: ytmusicapi/parsers.py:246
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:224
|
||||
#: ytmusicapi/parsers.py:253
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:222 ytmusicapi/parsers.py:229
|
||||
#: ytmusicapi/parsers.py:235
|
||||
msgid "album"
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/ytmusic.py:69
|
||||
msgid "Hello World"
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr ""
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr ""
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr "artista"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr "lista de reproducción"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr "canción"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr "vídeo"
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr "álbum"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr "álbumes"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr "sencillos"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr "vídeos"
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr "listas de reproducción"
|
||||
|
||||
#~ msgid "album"
|
||||
#~ msgstr "álbum"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr "artiste"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr "playlist"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr "titre"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr "vidéo"
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr "album"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr "albums"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr "singles"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr "vidéos"
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr "playlists"
|
||||
|
||||
#~ msgid "album"
|
||||
#~ msgstr "album"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr "artista"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr "playlist"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr "brano"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr "video"
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr "album"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr "album"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr "singoli"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr "video"
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr "playlist"
|
||||
|
||||
#~ msgid "album"
|
||||
#~ msgstr "album"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
|||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-07-09 14:10+0200\n"
|
||||
"POT-Creation-Date: 2020-07-21 09:15+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "artist"
|
||||
msgstr "アーティスト"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "playlist"
|
||||
msgstr "プレイリスト"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "song"
|
||||
msgstr "曲"
|
||||
|
||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
||||
#: ytmusicapi/parsers.py:44
|
||||
msgid "video"
|
||||
msgstr "動画"
|
||||
|
||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
||||
msgid "album"
|
||||
msgstr "アルバム"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "albums"
|
||||
msgstr "アルバム"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "singles"
|
||||
msgstr "シングル"
|
||||
|
||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "videos"
|
||||
msgstr "動画"
|
||||
|
||||
#: ytmusicapi/parsers.py:93
|
||||
msgid "playlists"
|
||||
msgstr "プレイリスト"
|
||||
|
||||
#~ msgid "album"
|
||||
#~ msgstr "アルバム"
|
||||
|
|
|
|||
8
ytmusicapi/locales/update_mo.sh
Normal file
8
ytmusicapi/locales/update_mo.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
for dir in *
|
||||
do
|
||||
if [ ${#dir} -eq 2 ];
|
||||
then
|
||||
msgfmt -o ${dir}/LC_MESSAGES/base.mo ${dir}/LC_MESSAGES/base
|
||||
fi
|
||||
done
|
||||
8
ytmusicapi/locales/update_po.sh
Normal file
8
ytmusicapi/locales/update_po.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
for dir in *
|
||||
do
|
||||
if [ ${#dir} -eq 2 ];
|
||||
then
|
||||
msgmerge --update ${dir}/LC_MESSAGES/base.po base.pot --no-fuzzy-matching
|
||||
fi
|
||||
done
|
||||
|
|
@ -100,7 +100,6 @@ class BrowsingMixin:
|
|||
|
||||
return search_results
|
||||
|
||||
@i18n
|
||||
def get_artist(self, channelId: str) -> Dict:
|
||||
"""
|
||||
Get information about an artist and their top releases (songs,
|
||||
|
|
@ -200,41 +199,7 @@ class BrowsingMixin:
|
|||
artist['songs']['browseId'] = nav(musicShelf, TITLE + NAVIGATION_BROWSE_ID)
|
||||
artist['songs']['results'] = parse_playlist_items(musicShelf['contents'])
|
||||
|
||||
categories = ['albums', 'singles', 'videos']
|
||||
categories_local = [_('albums'), _('singles'), _('videos')]
|
||||
for i, category in enumerate(categories):
|
||||
data = [
|
||||
r['musicCarouselShelfRenderer'] for r in results
|
||||
if 'musicCarouselShelfRenderer' in r
|
||||
and nav(r['musicCarouselShelfRenderer'],
|
||||
CAROUSEL_TITLE)['text'].lower() == categories_local[i]
|
||||
]
|
||||
if len(data) > 0:
|
||||
artist[category] = {'browseId': None, 'results': []}
|
||||
if 'navigationEndpoint' in nav(data[0], CAROUSEL_TITLE):
|
||||
artist[category]['browseId'] = nav(data[0],
|
||||
CAROUSEL_TITLE + NAVIGATION_BROWSE_ID)
|
||||
if category in ['albums', 'singles']:
|
||||
artist[category]['params'] = nav(
|
||||
data[0],
|
||||
CAROUSEL_TITLE)['navigationEndpoint']['browseEndpoint']['params']
|
||||
|
||||
for item in data[0]['contents']:
|
||||
item = item['musicTwoRowItemRenderer']
|
||||
result = {'title': nav(item, TITLE_TEXT)}
|
||||
result['thumbnails'] = nav(item, THUMBNAIL_RENDERER)
|
||||
if category == 'albums':
|
||||
result['year'] = nav(item, SUBTITLE2)
|
||||
result['browseId'] = nav(item, TITLE + NAVIGATION_BROWSE_ID)
|
||||
elif category == 'singles':
|
||||
result['year'] = nav(item, SUBTITLE)
|
||||
result['browseId'] = nav(item, TITLE + NAVIGATION_BROWSE_ID)
|
||||
elif category == 'videos':
|
||||
result['views'] = nav(item, SUBTITLE2).split(' ')[0]
|
||||
result['videoId'] = nav(item, NAVIGATION_VIDEO_ID)
|
||||
result['playlistId'] = nav(item, NAVIGATION_PLAYLIST_ID)
|
||||
artist[category]['results'].append(result)
|
||||
|
||||
artist.update(self.parser.parse_artist_contents(results))
|
||||
return artist
|
||||
|
||||
def get_artist_albums(self, channelId: str, params: str) -> List[Dict]:
|
||||
|
|
@ -370,3 +335,98 @@ class BrowsingMixin:
|
|||
album['tracks'].append(track)
|
||||
|
||||
return album
|
||||
|
||||
def get_user(self, channelId: str) -> Dict:
|
||||
"""
|
||||
Retrieve a user's page. A user may own videos or playlists.
|
||||
|
||||
:param channelId: channelId of the user
|
||||
:return: Dictionary with information about a user.
|
||||
|
||||
Example::
|
||||
|
||||
{
|
||||
"name": "4Tune – No Copyright Music",
|
||||
"videos": {
|
||||
"browseId": "UC44hbeRoCZVVMVg5z0FfIww",
|
||||
"results": [
|
||||
{
|
||||
"title": "Epic Music Soundtracks 2019",
|
||||
"videoId": "bJonJjgS2mM",
|
||||
"playlistId": "RDAMVMbJonJjgS2mM",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/bJon...",
|
||||
"width": 800,
|
||||
"height": 450
|
||||
}
|
||||
],
|
||||
"views": "19K"
|
||||
}
|
||||
]
|
||||
},
|
||||
"playlists": {
|
||||
"browseId": "UC44hbeRoCZVVMVg5z0FfIww",
|
||||
"results": [
|
||||
{
|
||||
"title": "♚ Machinimasound | Playlist",
|
||||
"playlistId": "PLRm766YvPiO9ZqkBuEzSTt6Bk4eWIr3gB",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/...",
|
||||
"width": 400,
|
||||
"height": 225
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"params": "6gO3AUNvWU..."
|
||||
}
|
||||
}
|
||||
"""
|
||||
endpoint = 'browse'
|
||||
body = {"browseId": channelId}
|
||||
response = self._send_request(endpoint, body)
|
||||
user = {'name': nav(response, ['header', 'musicVisualHeaderRenderer'] + TITLE_TEXT)}
|
||||
results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST)
|
||||
user.update(self.parser.parse_artist_contents(results))
|
||||
return user
|
||||
|
||||
def get_user_playlists(self, channelId: str, params: str) -> List[Dict]:
|
||||
"""
|
||||
Retrieve a list of playlists for a given user.
|
||||
Call this function again with the returned ``params`` to get the full list.
|
||||
|
||||
:param channelId: channelId of the user.
|
||||
:param params: params obtained by :py:func:`get_artist`
|
||||
:return: List of user playlists.
|
||||
|
||||
Example::
|
||||
|
||||
[
|
||||
{
|
||||
"browseId": "VLPLkqz3S84Tw-T4WwdS5EAMHegVhWH9vZIx",
|
||||
"title": "Top 10 vídeos del momento... hasta el momento! | Vevo Playlist",
|
||||
"thumbnails": [
|
||||
{
|
||||
"url": "https://i.ytimg.com/vi/...",
|
||||
"width": 400,
|
||||
"height": 225
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
"""
|
||||
endpoint = 'browse'
|
||||
body = {"browseId": channelId, 'params': params}
|
||||
response = self._send_request(endpoint, body)
|
||||
data = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST + MUSIC_SHELF)
|
||||
user_playlists = []
|
||||
for result in data['contents']:
|
||||
data = result['musicResponsiveListItemRenderer']
|
||||
user_playlists.append({
|
||||
"browseId": nav(data, NAVIGATION_BROWSE_ID),
|
||||
"title": get_item_text(data, 0),
|
||||
"thumbnails": nav(data, THUMBNAILS),
|
||||
})
|
||||
return user_playlists
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ class LibraryMixin:
|
|||
results = find_object_by_key(nav(response, SINGLE_COLUMN_TAB + SECTION_LIST),
|
||||
'itemSectionRenderer')
|
||||
results = nav(results, ITEM_SECTION)['gridRenderer']
|
||||
playlists = parse_playlists(results['items'][1:])
|
||||
playlists = parse_content_list(results['items'][1:], parse_playlist)
|
||||
|
||||
if 'continuations' in results:
|
||||
request_func = lambda additionalParams: self._send_request(
|
||||
endpoint, body, additionalParams)
|
||||
parse_func = lambda contents: parse_playlists(contents)
|
||||
parse_func = lambda contents: parse_content_list(contents, parse_playlist)
|
||||
playlists.extend(
|
||||
get_continuations(results, 'gridContinuation', 25, limit, request_func,
|
||||
parse_func))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from ytmusicapi.helpers import i18n
|
||||
from typing import List, Dict
|
||||
# commonly used navigation paths
|
||||
SINGLE_COLUMN_TAB = [
|
||||
'contents', 'singleColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content'
|
||||
|
|
@ -86,21 +87,78 @@ class Parser:
|
|||
|
||||
return search_result
|
||||
|
||||
@i18n
|
||||
def parse_artist_contents(self, results: List) -> Dict:
|
||||
categories = ['albums', 'singles', 'videos', 'playlists']
|
||||
categories_local = [_('albums'), _('singles'), _('videos'), _('playlists')]
|
||||
artist = {}
|
||||
for i, category in enumerate(categories):
|
||||
data = [
|
||||
r['musicCarouselShelfRenderer'] for r in results
|
||||
if 'musicCarouselShelfRenderer' in r
|
||||
and nav(r['musicCarouselShelfRenderer'],
|
||||
CAROUSEL_TITLE)['text'].lower() == categories_local[i]
|
||||
]
|
||||
if len(data) > 0:
|
||||
artist[category] = {'browseId': None, 'results': []}
|
||||
if 'navigationEndpoint' in nav(data[0], CAROUSEL_TITLE):
|
||||
artist[category]['browseId'] = nav(data[0],
|
||||
CAROUSEL_TITLE + NAVIGATION_BROWSE_ID)
|
||||
if category in ['albums', 'singles', 'playlists']:
|
||||
artist[category]['params'] = nav(
|
||||
data[0],
|
||||
CAROUSEL_TITLE)['navigationEndpoint']['browseEndpoint']['params']
|
||||
|
||||
def parse_playlists(results):
|
||||
playlists = []
|
||||
if category == 'videos':
|
||||
parse_func = parse_video
|
||||
elif category == 'playlists':
|
||||
parse_func = parse_playlist
|
||||
else:
|
||||
parse_func = parse_album
|
||||
|
||||
artist[category]['results'] = parse_content_list(data[0]['contents'], parse_func)
|
||||
|
||||
return artist
|
||||
|
||||
|
||||
def parse_content_list(results, parse_func):
|
||||
contents = []
|
||||
for result in results:
|
||||
data = result['musicTwoRowItemRenderer']
|
||||
playlist = {}
|
||||
playlist['playlistId'] = nav(data, TITLE + NAVIGATION_BROWSE_ID)[2:]
|
||||
playlist['title'] = nav(data, TITLE_TEXT)
|
||||
playlist['thumbnails'] = nav(data, THUMBNAIL_RENDERER)
|
||||
if len(data['subtitle']['runs']) == 3:
|
||||
playlist['count'] = nav(data, SUBTITLE2).split(' ')[0]
|
||||
contents.append(parse_func(result['musicTwoRowItemRenderer']))
|
||||
|
||||
playlists.append(playlist)
|
||||
return contents
|
||||
|
||||
return playlists
|
||||
|
||||
def parse_album(result):
|
||||
location = SUBTITLE if len(result['subtitle']['runs']) == 1 else SUBTITLE2
|
||||
return {
|
||||
'title': nav(result, TITLE_TEXT),
|
||||
'year': nav(result, location),
|
||||
'browseId': nav(result, TITLE + NAVIGATION_BROWSE_ID)
|
||||
}
|
||||
|
||||
|
||||
def parse_video(result):
|
||||
video = {
|
||||
'title': nav(result, TITLE_TEXT),
|
||||
'videoId': nav(result, NAVIGATION_VIDEO_ID),
|
||||
'playlistId': nav(result, NAVIGATION_PLAYLIST_ID),
|
||||
'thumbnails': nav(result, THUMBNAIL_RENDERER)
|
||||
}
|
||||
if len(result['subtitle']['runs']) == 3:
|
||||
video['views'] = nav(result, SUBTITLE2).split(' ')[0]
|
||||
return video
|
||||
|
||||
|
||||
def parse_playlist(data):
|
||||
playlist = {
|
||||
'title': nav(data, TITLE_TEXT),
|
||||
'playlistId': nav(data, TITLE + NAVIGATION_BROWSE_ID)[2:],
|
||||
'thumbnails': nav(data, THUMBNAIL_RENDERER)
|
||||
}
|
||||
if len(data['subtitle']['runs']) == 3:
|
||||
playlist['count'] = nav(data, SUBTITLE2).split(' ')[0]
|
||||
return playlist
|
||||
|
||||
|
||||
def parse_artists(results, uploaded=False):
|
||||
|
|
@ -309,9 +367,9 @@ def parse_song_album(data, index):
|
|||
|
||||
def get_item_text(item, index, run_index=0, none_if_absent=False):
|
||||
column = get_flex_column_item(item, index)
|
||||
if not column:
|
||||
return None
|
||||
if none_if_absent and len(column['text']['runs']) < run_index+1:
|
||||
if not column:
|
||||
return None
|
||||
if none_if_absent and len(column['text']['runs']) < run_index + 1:
|
||||
return None
|
||||
return column['text']['runs'][run_index]['text']
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue