Home > other >  PYTHON climb cloud music cannot show normal ID number
PYTHON climb cloud music cannot show normal ID number

Time:10-18

 import requests 
The from bs4 import BeautifulSoup
Url='https://music.163.com/#/discover/toplist' # cloud music soared list
Headers={
'the user-agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 '
}
Res=requests. Get (url=url, headers=headers)
Soup=BeautifulSoup (res) text, '. The HTML parser)
Songs=soup. Select ('. M - table. M - table - rank tr ')
For each songs in [2] : # first line says title

The link='https://music.163.com/' + each. The select (. TXT a ') [0] [' href ']
Name=each. The select (. TXT a, b ') [0] [' title ']
# time=each. The select (. 'u - dur') [0]. The text
PIC=each. Select ('. Tt. Rpic ') [0] [' SRC ']

# print (' title: % s, address: % s, image: % s' % (name, link, PIC))
Print (link)

According to the result:
Title: ${x.n ame | escape} {if alia} - (${alia | escape})/{if}, address: https://music.163.com//song? Id=${x.i d}, image: ${x.a lbum. PicUrl}? Param=50 y50 & amp; Quality=100
This is what circumstance, the website the climb

CodePudding user response:

Just learn a little bit crawler nature for me
  • Related