• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > 使用Python实现下载网易云音乐的高清MV

使用Python实现下载网易云音乐的高清MV

作者:hebedich 字体:[增加 减小] 来源:互联网

hebedich 通过本文主要向大家介绍了python爬虫网易云音乐,python 网易云音乐,网易云音乐mv黑屏,网易云音乐mv下载,网易云音乐mv等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

Python下载网易云音乐的高清MV,没有从首页进去解析,直接循环了....

downPage1.py

#coding=utf-8
import urllib
import re
import os
def getHtml(url):
    page = urllib.urlopen(url)
    html = page.read()
    return html
def getVideo(html):
    reg = r'hurl=(.+?\.jpg)'
    imgre = re.compile(reg)
    imglist = re.findall(imgre,html)
    return imglist
for num in range(28000,1000000):
    print num
    html = getHtml("http://music.163.com/mv?id=%s"%num)
    parsed = getVideo(html)
    if  len(parsed)==0:
        continue
    vedioUrls = parsed[0].split("&")
    artist = vedioUrls[4].split("=")[1].decode('utf-8').strip()
    song = vedioUrls[3].split("=")[1].decode('utf-8').strip()
    if  len(vedioUrls[0])==0:
        continue
    filename = '%s/%s.mp4' %(artist,song)
    if "/" in song:
        continue
    if os.path.exists(filename):
        print 'the MV file exists.%s'%num
    else:
        print 'the MV is downloding.%s'%num
        if  os.path.exists(artist):
            print ""
        else:
            os.makedirs(artist)
        urllib.urlretrieve(vedioUrls[0],filename)
</div>

以上就是本文分享的全部代码了,希望大家能够喜欢。

</div>

您可能想查找下面的文章:

  • Python爬取网易云音乐热门评论
  • 使用Python实现下载网易云音乐的高清MV
  • 使用Python实现下载网易云音乐的高清MV

相关文章

  • Python实现的简单文件传输服务器和客户端
  • python实现的解析crontab配置文件代码
  • python 装饰器功能以及函数参数使用介绍
  • python用于url解码和中文解析的小脚本(python url decoder)
  • 深入讲解Java编程中类的生命周期
  • 举例简单讲解Python中的数据存储模块shelve的用法
  • 用Python编写web API的教程
  • Python使用ftplib实现简易FTP客户端的方法
  • python 实现网上商城,转账,存取款等功能的信用卡系统
  • python获取指定时间差的时间实例详解

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • 分析Python中设计模式之Decorator装饰器模式的要点
    • Python异常处理总结
    • 为Python的web框架编写MVC配置来使其运行的教程
    • 巧用Python装饰器 免去调用父类构造函数的麻烦
    • Python数据结构之翻转链表
    • Python 备份程序代码实现
    • python嵌套函数使用外部函数变量的方法(Python2和Python3)
    • Python Django使用forms来实现评论功能
    • Python struct模块解析
    • 详解Python的Django框架中的Cookie相关处理

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有