def __getSongs__(self): print "----getSongs----" url = self.__urlList__.pop() if self.__usedList__.count(url) == 0: self.__usedList__.append(url) html = UrlUtil.get_content(url) if html is None: yield self.__getSongs__() else: soup = BeautifulSoup(html, 'html5lib') print url if self.TYPE == self.__CLASSIFY__: yield self.__getClassifyMusic__(soup) return
# -*- coding: UTF-8 -*- # -*- author: kexiaohong -*- import UrlUtil import SongUtil import ConstData from bs4 import BeautifulSoup if __name__ == '__main__': html = UrlUtil.get_content(ConstData.baseBaiduUrl) if html is not None: soup = BeautifulSoup(html,'html5lib') SongUtil.getindexsongs(soup) SongUtil.gettypesongs(soup)