tombulled / python-youtube-music

Python 3 YouTube Music Web API Client
GNU General Public License v3.0
65 stars 14 forks source link

Method - Search Songs doesn't return artists name / data and duration. #19

Closed C0d3R71 closed 2 years ago

C0d3R71 commented 2 years ago
import ytm
api = ytm.YouTubeMusic()
from pprint import pprint
songs = api.search_songs('cry')
pprint(songs)
{'continuation': 'EqoDEgNjcnkaogNFZy1LQVF3SUFSQUFHQUFnQUNnQU1BQklGR29LRUFNUUJCQUpFQW9RQllJQkN6Y3RUbkZhYVdRM09YaG5nZ0VMTTNWYVNVcDVkVEp0TkRTQ0FRdHljSGRXUzJOUFF6TnJSWUlCQzNSMGVUVTBRM3BZV2tSbmdnRUxSMVZXY2xCT1ZHTkVORTJDQVF0SVlWbGhNR3BWTlc1WFZZSUJDM0kwVEVkbE1USjBUbEk0Z2dFTGJUbDNORXhGTlRGQk5GV0NBUXRrUjBneFZFeDZiSFZ3VFlJQkMwb3pURk5EVFdoVlJGUlpnZ0VMWkZGa1NXZG1kVWxWZUUyQ0FRdElZMjlMTTBNdFlreGtSWUlCQzBONU9UY3lkVzl2YzJOVmdnRUxlSGM0VWpoWWNqUjNTelNDQVFzeFgxcE1WSFl3ZFc1clo0SUJDM3BpVjNCcWFYcHdTbVpKZ2dFTE1HMUViREJoV0ZadmVFR0NBUXRPT0RaU1VGZHFVRGh5YTRJQkMzcG1ibXROUWs5VFNWVlJnZ0VMYTFSdFdtNVJUMlpCUmpnJTNEGPHq0C4%3D',
'items': [{'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': '7-NqZid79xg',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVM7-NqZid79xg'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/MOhTCq9cNRT5svfXVBn7NqT_cF7ksX8n6659_lYhHQU8FIAYhMoeV6eHxnIkHDdxs-9360sDF6KCCtnHAA=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': '3uZIJyu2m44',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVM3uZIJyu2m44'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/eIxvwfBd3p4pESHUS-F0Udxlzan5uxBFf6p7dGuMBGg__3JklsPFmAkVbxhvoKZNnZ0EW-0Zq_CXZktDmg=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'rpwVKcOC3kE',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMrpwVKcOC3kE'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/L0nwBz3JF8kFa1-1PAOiLC6pB49lsRc3QRCbj1gvU3uCNf4SXnLUGtAFBha1CZ02mhQzMJrcl-rJ0pSG=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry Baby'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'tty54CzXZDg',
            'name': 'Cry Baby',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMtty54CzXZDg'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/zZy89DQBNNe9nMoOeR-xiJKiINPI1Y1YzePRO2Fwt4pj20Tm_FkBHnQODMAoxapzaT_tiSacaKR3TiVb=w120-h120-s-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': True,
            'id': 'GUVrPNTcD4M',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMGUVrPNTcD4M'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/fgIxUTO49TLbvsXtaWvAdHmvnJUSgdY6I2IK0QRJyUBM0CyyDmLzmZ9mxCwKAOyN-UewCP4zIB9jpxGX0A=w120-h120-s-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'I Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'HaYa0jU5nWU',
            'name': 'I Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMHaYa0jU5nWU'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/8jMWMYRapqtyX_YCE0VRJfAhkALHt7D5cVgVyyVevajj--rS7DXzKFX26URVIO3ixg84HkcdmgG8KB9a=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry Baby'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'r4LGe12tNR8',
            'name': 'Cry Baby',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMr4LGe12tNR8'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/-kb2G0v5A95Exch1a4YJTopQoX7mnqkEOrD1PI81gCzsqgidXe-gim5dNDLVcfacX59fNcB8ruK5GUZdgA=w120-h120-s-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': True,
            'id': 'm9w4LE51A4U',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMm9w4LE51A4U'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/QRPrcFOvhFSY4Yx_yPqwgmI3MeSZHrQvW2fm-OAEtqw6uJE7yGDK0vLrYn8cdW2WNRNMid_AP4HmQAVw=w120-h120-s-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': True,
            'id': 'dGH1TLzlupM',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMdGH1TLzlupM'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/mkL9IhDIiqFBdaOyAESbM_R5yMD0baUUvpSkuzu9PbPPiO0XO35dHivQvQ8FQvcJWHu5s2CkPV0DFzM=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry Baby'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'J3LSCMhUDTY',
            'name': 'Cry Baby',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMJ3LSCMhUDTY'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/woTD8VlPGhg150OkS5meC34r2yfLBtMlHUS771sdBwvFUGKcL8f3al2X9zbxBvjXIRaeVdjICNd6xLrneA=w120-h120-s-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Big Girls Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'dQdIgfuIUxM',
            'name': 'Big Girls Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMdQdIgfuIUxM'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/YTKwsJicv1Hi6R5qJpgiBAkNcWPYOVSGMsqRM8bmhKuMHDWk2zJ3ee3UcT930KmId02LYThjfGoBAEib=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Thug Cry (feat. Lil Wayne)'},
            'artists': [],
            'duration': None,
            'explicit': True,
            'id': 'HcoK3C-bLdE',
            'name': 'Thug Cry (feat. Lil Wayne)',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMHcoK3C-bLdE'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/00ZYuGOXu2D0kWTmiY-He_x3md_NMGoUyU_Vhwizjyxov_E9yodME16JM4gw8VxqjaftlPIH3HztFBp-=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry Cry Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'Cy972uooscU',
            'name': 'Cry Cry Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMCy972uooscU'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/49WAwREEnEy4zlpg1xCLeBUjcOfFqpKPu0aQ2Z4C-Ho13BK3kW0mwNe-vAFayQh8UZ-qNlEVvLn7Xgut=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'xw8R8Xr4wK4',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMxw8R8Xr4wK4'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/6DbOfzJIgHUxRQQ01shAoapdFjmMU4Jm2CDooAWomm4BmvhgigfQFWuBz0qWhf_EZEtRHskEpD5bU6fr=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': '1_ZLTv0unkg',
            'name': 'Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVM1_ZLTv0unkg'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/CxgGCKgsknul9wk-tolXQ8MdZXD71WYuA05zhQkkA46n1EiHvAVY9bAG8sR1JS-asDns8gzbzZNr848ZnA=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None,
                      'name': 'Laugh Now Cry Later (feat. Lil Durk)'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'zbWpjizpJfI',
            'name': 'Laugh Now Cry Later (feat. Lil Durk)',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMzbWpjizpJfI'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/HsYFEWy519yla31vBkgj0fNOOmHCiCWyCyzSVfL2Wxo3gN0XwHFG7D2yatAKlpACi9ywvx_iUd398oF1Ng=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Cry, Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': '0mDl0aXVoxA',
            'name': 'Cry, Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVM0mDl0aXVoxA'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/g2UPQJOHMO71PzlqVo1T-6s9QxiRvs7Aa4wnPjnJ7YZ-eZrURIFh2qzvJ82pY5e8AzBZMCZKWMiOPo9u=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Battle Cry (Kenny Omega Theme)'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'N86RPWjP8rk',
            'name': 'Battle Cry (Kenny Omega Theme)',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMN86RPWjP8rk'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/M7mgPAr40L2MEzeVYJYOVoWWs1tzkWfxXnRF882I_iF37nocoH7kH7rpFXAY51q8JN48S7jjdjha-dAgMA=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': "I'll Cry Instead (Remastered 2009)"},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'zfnkMBOSIUQ',
            'name': "I'll Cry Instead (Remastered 2009)",
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMzfnkMBOSIUQ'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/EO81br_-ABNZsAoWN24yJnsNfxHoo0KGB_XEXkW-PFFT74JlNDPZlO48yONoQiQ2bbXxtn184eez2zk=w120-h120-l90-rj',
                          'width': 120}},
           {'album': {'id': None, 'name': 'Should I Laugh Or Cry'},
            'artists': [],
            'duration': None,
            'explicit': False,
            'id': 'kTmZnQOfAF8',
            'name': 'Should I Laugh Or Cry',
            'radio': {'params': 'wAEB', 'playlist_id': 'RDAMVMkTmZnQOfAF8'},
            'thumbnail': {'height': 120,
                          'url': 'https://lh3.googleusercontent.com/o8oDrht3k07wuS8m28wSfVJFS8d10uUmJiq2WP47sTbV8ekvYzCBHp7gjsR_1Y_oXVDytKmX_2ZEuRk=w120-h120-l90-rj',
                          'width': 120}}]}
tombulled commented 2 years ago

I've opened a PR with a few minor changes that should hopefully fix this issue. If you get a chance to test the changes and confirm if they resolve this issue that'd be greatly appreciated. No worries if not :slightly_smiling_face:

C0d3R71 commented 2 years ago

I tested this, it is now working perfectly fine. thanks for prompt help.