I am having a hard time finding problems with some codes. There should be a problem with the URL you spliced ??together. You can print out the complete URL after entering the ID, and enter the URL into the browser to see if there is any problem.
url = '/discover/toplist?id='
a = input('Please enter the ID of the list:')
Part of the code is as follows:
a_url = a+url Are you sure there is no problem after splicing here?
base_url = '/song/media/outer/url?id='
# a = input('Please enter the ID of the playlist: ')