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
|
||||||
.. automethod:: YTMusic.get_artist_albums
|
.. automethod:: YTMusic.get_artist_albums
|
||||||
|
.. automethod:: YTMusic.get_user
|
||||||
|
.. automethod:: YTMusic.get_user_playlists
|
||||||
.. automethod:: YTMusic.get_album
|
.. automethod:: YTMusic.get_album
|
||||||
|
|
||||||
Library
|
Library
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,16 @@ class TestYTMusic(unittest.TestCase):
|
||||||
artist['singles']['params'])
|
artist['singles']['params'])
|
||||||
self.assertGreater(len(results), 0)
|
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):
|
def test_get_album(self):
|
||||||
results = youtube_auth.get_album("MPREb_BQZvl3BFGay")
|
results = youtube_auth.get_album("MPREb_BQZvl3BFGay")
|
||||||
self.assertEqual(len(results), 9)
|
self.assertEqual(len(results), 9)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Copy the base template:
|
||||||
Update translation
|
Update translation
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
``msgmerge --update locales/de/LC_MESSAGES/base.po locales/base.pot``
|
``cd locales && sh update_po.sh``
|
||||||
|
|
||||||
Edit translation
|
Edit translation
|
||||||
----------------
|
----------------
|
||||||
|
|
@ -37,4 +37,4 @@ Finalize translation
|
||||||
---------------------
|
---------------------
|
||||||
To generate mo files, run
|
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 ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,34 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ytmusicapi/parsers.py:93
|
||||||
|
msgid "playlists"
|
||||||
|
msgstr ""
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
||||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr "künstler"
|
msgstr "künstler"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr "playlist"
|
msgstr "playlist"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr "titel"
|
msgstr "titel"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr "video"
|
msgstr "video"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr "album"
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr "alben"
|
msgstr "alben"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr "singles"
|
msgstr "singles"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr "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
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,31 +17,34 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:229
|
#: ytmusicapi/parsers.py:44
|
||||||
#: ytmusicapi/parsers.py:232
|
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:229
|
#: ytmusicapi/parsers.py:44
|
||||||
#: ytmusicapi/parsers.py:241
|
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:224
|
#: ytmusicapi/parsers.py:44
|
||||||
#: ytmusicapi/parsers.py:246
|
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:221 ytmusicapi/parsers.py:224
|
#: ytmusicapi/parsers.py:44
|
||||||
#: ytmusicapi/parsers.py:253
|
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:222 ytmusicapi/parsers.py:229
|
#: ytmusicapi/parsers.py:93
|
||||||
#: ytmusicapi/parsers.py:235
|
msgid "albums"
|
||||||
msgid "album"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:69
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "Hello World"
|
msgid "singles"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ytmusicapi/parsers.py:93
|
||||||
|
msgid "videos"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ytmusicapi/parsers.py:93
|
||||||
|
msgid "playlists"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -2,13 +2,13 @@
|
||||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr "artista"
|
msgstr "artista"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr "lista de reproducción"
|
msgstr "lista de reproducción"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr "canción"
|
msgstr "canción"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr "vídeo"
|
msgstr "vídeo"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr "álbum"
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr "álbumes"
|
msgstr "álbumes"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr "sencillos"
|
msgstr "sencillos"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr "vídeos"
|
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
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr "artiste"
|
msgstr "artiste"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr "playlist"
|
msgstr "playlist"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr "titre"
|
msgstr "titre"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr "vidéo"
|
msgstr "vidéo"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr "album"
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr "albums"
|
msgstr "albums"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr "singles"
|
msgstr "singles"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr "vidéos"
|
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
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr "artista"
|
msgstr "artista"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr "playlist"
|
msgstr "playlist"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr "brano"
|
msgstr "brano"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr "video"
|
msgstr "video"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr "album"
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr "album"
|
msgstr "album"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr "singoli"
|
msgstr "singoli"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr "video"
|
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
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
#
|
#
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,34 +17,37 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:55
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "artist"
|
msgid "artist"
|
||||||
msgstr "アーティスト"
|
msgstr "アーティスト"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:64
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "playlist"
|
msgid "playlist"
|
||||||
msgstr "プレイリスト"
|
msgstr "プレイリスト"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:69
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "song"
|
msgid "song"
|
||||||
msgstr "曲"
|
msgstr "曲"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:44 ytmusicapi/parsers.py:47 ytmusicapi/parsers.py:76
|
#: ytmusicapi/parsers.py:44
|
||||||
msgid "video"
|
msgid "video"
|
||||||
msgstr "動画"
|
msgstr "動画"
|
||||||
|
|
||||||
#: ytmusicapi/parsers.py:45 ytmusicapi/parsers.py:52 ytmusicapi/parsers.py:58
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "album"
|
|
||||||
msgstr "アルバム"
|
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:328
|
|
||||||
msgid "albums"
|
msgid "albums"
|
||||||
msgstr "アルバム"
|
msgstr "アルバム"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:331
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "singles"
|
msgid "singles"
|
||||||
msgstr "シングル"
|
msgstr "シングル"
|
||||||
|
|
||||||
#: ytmusicapi/ytmusic.py:307 ytmusicapi/ytmusic.py:334
|
#: ytmusicapi/parsers.py:93
|
||||||
msgid "videos"
|
msgid "videos"
|
||||||
msgstr "動画"
|
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
|
return search_results
|
||||||
|
|
||||||
@i18n
|
|
||||||
def get_artist(self, channelId: str) -> Dict:
|
def get_artist(self, channelId: str) -> Dict:
|
||||||
"""
|
"""
|
||||||
Get information about an artist and their top releases (songs,
|
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']['browseId'] = nav(musicShelf, TITLE + NAVIGATION_BROWSE_ID)
|
||||||
artist['songs']['results'] = parse_playlist_items(musicShelf['contents'])
|
artist['songs']['results'] = parse_playlist_items(musicShelf['contents'])
|
||||||
|
|
||||||
categories = ['albums', 'singles', 'videos']
|
artist.update(self.parser.parse_artist_contents(results))
|
||||||
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)
|
|
||||||
|
|
||||||
return artist
|
return artist
|
||||||
|
|
||||||
def get_artist_albums(self, channelId: str, params: str) -> List[Dict]:
|
def get_artist_albums(self, channelId: str, params: str) -> List[Dict]:
|
||||||
|
|
@ -370,3 +335,98 @@ class BrowsingMixin:
|
||||||
album['tracks'].append(track)
|
album['tracks'].append(track)
|
||||||
|
|
||||||
return album
|
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),
|
results = find_object_by_key(nav(response, SINGLE_COLUMN_TAB + SECTION_LIST),
|
||||||
'itemSectionRenderer')
|
'itemSectionRenderer')
|
||||||
results = nav(results, ITEM_SECTION)['gridRenderer']
|
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:
|
if 'continuations' in results:
|
||||||
request_func = lambda additionalParams: self._send_request(
|
request_func = lambda additionalParams: self._send_request(
|
||||||
endpoint, body, additionalParams)
|
endpoint, body, additionalParams)
|
||||||
parse_func = lambda contents: parse_playlists(contents)
|
parse_func = lambda contents: parse_content_list(contents, parse_playlist)
|
||||||
playlists.extend(
|
playlists.extend(
|
||||||
get_continuations(results, 'gridContinuation', 25, limit, request_func,
|
get_continuations(results, 'gridContinuation', 25, limit, request_func,
|
||||||
parse_func))
|
parse_func))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from ytmusicapi.helpers import i18n
|
from ytmusicapi.helpers import i18n
|
||||||
|
from typing import List, Dict
|
||||||
# commonly used navigation paths
|
# commonly used navigation paths
|
||||||
SINGLE_COLUMN_TAB = [
|
SINGLE_COLUMN_TAB = [
|
||||||
'contents', 'singleColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content'
|
'contents', 'singleColumnBrowseResultsRenderer', 'tabs', 0, 'tabRenderer', 'content'
|
||||||
|
|
@ -86,21 +87,78 @@ class Parser:
|
||||||
|
|
||||||
return search_result
|
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):
|
if category == 'videos':
|
||||||
playlists = []
|
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:
|
for result in results:
|
||||||
data = result['musicTwoRowItemRenderer']
|
contents.append(parse_func(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]
|
|
||||||
|
|
||||||
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):
|
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):
|
def get_item_text(item, index, run_index=0, none_if_absent=False):
|
||||||
column = get_flex_column_item(item, index)
|
column = get_flex_column_item(item, index)
|
||||||
if not column:
|
if not column:
|
||||||
return None
|
return None
|
||||||
if none_if_absent and len(column['text']['runs']) < run_index+1:
|
if none_if_absent and len(column['text']['runs']) < run_index + 1:
|
||||||
return None
|
return None
|
||||||
return column['text']['runs'][run_index]['text']
|
return column['text']['runs'][run_index]['text']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue