Git Product home page Git Product logo

music-crawler's Introduction

music-crawler

对国内某互联网公司的音乐爬虫

code Example in Main.py

'''
this file show you how to crawl a playlist 
and save the mp3 files , music info files into disk 
you should provide follow infos : 
	1、palylist url
	2、your cookie in login state
	3、directory paths to save PlayListInfo josn files、musicInfo josn files and mp3 files, you can change those diretories paths in Constants.py
'''

from PlayListDownloader import *
from PlayListParser import *

#replace the placeHolder with your own cookie
cookie = 'palaceHolder'
## playlist url  example, change id param if you want to crawl other playlists
url= "http://music.163.com/api/playlist/detail?id=123905597"

#download the play list as json text
playListDownloader = PlayListDownloader(timeout=5,cookie=cookie)
playListJsonText=playListDownloader.downloadPlayList(url)

#init the MP3Crawler with 10 work threads
crawler = MP3Crawler("MP3Crawler",10)
crawler.start()
    	
PlayListParser.init()
jsonData = PlayListParser.parser(playListJsonText)
#save the playListInfo
if PlayListParser.savePlayListInfo(jsonData):
	#save music Infos and  mp3 files
	PlayListParser.downloadMusics(jsonData,crawler)
	#wait to commplete
	crawler.waitUtilComplete()
else:
  	crawler.stop()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.