2

Python爬虫编程思想(86):项目实战--抓取豆瓣音乐排行榜

 2 years ago
source link: https://blog.csdn.net/nokiaguy/article/details/121538122
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Python爬虫编程思想(86):项目实战--抓取豆瓣音乐排行榜

        本文的例子抓取了豆瓣音乐Top250排行榜。使用requests抓取相关页面,并使用Beautiful Soup的方法选择器和正则表达式结合的方式分析HTML代码,最后将提取出的数据保存到music.csv文件中,这是一个CSV格式的文本。

豆瓣音乐Top250榜单的URL如下:

https://music.douban.com/top250

页面效果如图1所示。

页面下面是导航条,现在切换到第2页,第3页,会得到如下2个UR


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK