<s> __all__ = [ '<STR_LIT>' ] <EOL> import urllib . request , urllib . parse <EOL> from . . common import * <EOL> def douban_download ( url , output_dir = '<STR_LIT:.>' , merge = True , info_only = False , ** kwargs ) : <EOL> html = get_html ( url ) <EOL> if '<STR_LIT>' in url : <EOL> titles = re . findall ( r'<STR_LIT>' , html ) <EOL> song_id = re . findall ( r'<STR_LIT>' , html ) <EOL> song_ssid = re . findall ( r'<STR_LIT>' , html ) <EOL> get_song_url = '<STR_LIT>' <EOL> for i in range ( len ( titles ) ) : <EOL> title = titles [ i ] <EOL> datas = { <EOL> '<STR_LIT>' : song_id [ i ] , <EOL> '<STR_LIT>' : song_ssid [ i ] <EOL> } <EOL> post_params = urllib . parse . urlencode ( datas ) . encode ( '<STR_LIT:utf-8>' ) <EOL> try : <EOL> resp = urllib . request . urlopen ( get_song_url , post_params ) <EOL> resp_data = json . loads ( resp . read ( ) . decode ( '<STR_LIT:utf-8>' ) ) <EOL> real_url = resp_data [ '<STR_LIT:r>' ] <EOL> type , ext , size = url_info ( real_url ) <EOL> print_info ( site_info , title , type , size ) <EOL> except : <EOL> pass <EOL> if not info_only : <EOL> try : <EOL> download_urls ( [ real_url ] , title , ext , size , output_dir , merge = merge ) <EOL> except : <EOL> pass <EOL> else : <EOL> titles = re . findall ( r'<STR_LIT>' , html ) <EOL> real_urls = [ re . sub ( '<STR_LIT>' , '<STR_LIT:/>' , i ) for i in re . findall ( r'<STR_LIT>' , html ) ] <EOL> for i in range ( len ( titles ) ) : <EOL> title = titles [ i ] <EOL> real_url = real_urls [ i ] <EOL> type , ext , size = url_info ( real_url ) <EOL> print_info ( site_info , title , type , size ) <EOL> if not info_only : <EOL> download_urls ( [ real_url ] , title , ext , size , output_dir , merge = merge ) <EOL> site_info = "<STR_LIT>" <EOL> download = douban_download <EOL> download_playlist = playlist_not_supported ( '<STR_LIT>' ) </s>
