mirror of
https://github.com/soimort/you-get.git
synced 2025-02-02 16:24:00 +03:00
add support for SoundCloud, fix #33
This commit is contained in:
parent
0d1d713215
commit
311f5d1509
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,8 +8,10 @@ _*/
|
||||
*.download
|
||||
*.cmt.*
|
||||
*.3gp
|
||||
*.asf
|
||||
*.flv
|
||||
*.mkv
|
||||
*.mp3
|
||||
*.mp4
|
||||
*.mpg
|
||||
*.ts
|
||||
|
@ -1,12 +1,14 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.3dev-20121209
|
||||
0.3dev-20121210
|
||||
---------------
|
||||
|
||||
*Date: 2012-12-09*
|
||||
*Date: 2012-12-10*
|
||||
|
||||
* YouTube: downloading the highest available quality now
|
||||
* YouTube: downloading the highest available quality now.
|
||||
* Add support for:
|
||||
- SoundCloud
|
||||
|
||||
0.2.16
|
||||
------
|
||||
|
@ -14,6 +14,7 @@ Fork me on GitHub: <https://github.com/soimort/you-get>
|
||||
* Vimeo <http://vimeo.com>
|
||||
* Dailymotion <http://dailymotion.com>
|
||||
* Google+ <http://plus.google.com>
|
||||
* SoundCloud <http://soundcloud.com>
|
||||
* Youku (优酷) <http://www.youku.com>
|
||||
* Tudou (土豆) <http://www.tudou.com>
|
||||
* YinYueTai (音悦台) <http://www.yinyuetai.com>
|
||||
@ -202,6 +203,7 @@ You-Get基于优酷下载脚本[iambus/youku-lixian](https://github.com/iambus/y
|
||||
* Vimeo <http://vimeo.com>
|
||||
* Dailymotion <http://dailymotion.com>
|
||||
* Google+ <http://plus.google.com>
|
||||
* SoundCloud <http://soundcloud.com>
|
||||
* 优酷 <http://www.youku.com>
|
||||
* 土豆 <http://www.tudou.com>
|
||||
* 音悦台 <http://www.yinyuetai.com>
|
||||
|
@ -17,6 +17,7 @@ Supported Sites (As of Now)
|
||||
* Vimeo http://vimeo.com
|
||||
* Dailymotion http://dailymotion.com
|
||||
* Google+ http://plus.google.com
|
||||
* SoundCloud http://soundcloud.com
|
||||
* Youku (优酷) http://www.youku.com
|
||||
* Tudou (土豆) http://www.tudou.com
|
||||
* YinYueTai (音悦台) http://www.yinyuetai.com
|
||||
|
@ -125,7 +125,9 @@ def url_info(url, faker = False):
|
||||
'video/mp4': 'mp4',
|
||||
'video/MP2T': 'ts',
|
||||
'video/webm': 'webm',
|
||||
'video/x-flv': 'flv'
|
||||
'video/x-flv': 'flv',
|
||||
'video/x-ms-asf': 'asf',
|
||||
'audio/mpeg': 'mp3'
|
||||
}
|
||||
if type in mapping:
|
||||
ext = mapping[type]
|
||||
@ -355,7 +357,7 @@ def download_urls(urls, title, ext, total_size, output_dir = '.', refer = None,
|
||||
print('Real URLs:\n', urls, '\n')
|
||||
return
|
||||
|
||||
assert ext in ('3gp', 'flv', 'mp4', 'webm')
|
||||
#assert ext in ('3gp', 'flv', 'mp4', 'webm')
|
||||
if not total_size:
|
||||
try:
|
||||
total_size = urls_size(urls)
|
||||
@ -504,8 +506,12 @@ def playlist_not_supported(name):
|
||||
def print_info(site_info, title, type, size):
|
||||
if type in ['3gp']:
|
||||
type = 'video/3gpp'
|
||||
elif type in ['asf']:
|
||||
type = 'video/x-ms-asf'
|
||||
elif type in ['flv', 'f4v']:
|
||||
type = 'video/x-flv'
|
||||
elif type in ['mp3']:
|
||||
type = 'audio/mpeg'
|
||||
elif type in ['mp4']:
|
||||
type = 'video/mp4'
|
||||
elif type in ['ts']:
|
||||
@ -531,8 +537,12 @@ def print_info(site_info, title, type, size):
|
||||
# type_info = "Matroska video (%s)" % type
|
||||
#elif type in ['video/x-ms-wmv']:
|
||||
# type_info = "Windows Media video (%s)" % type
|
||||
elif type in ['video/x-ms-asf']:
|
||||
type_info = "Advanced Systems Format (%s)" % type
|
||||
#elif type in ['video/mpeg']:
|
||||
# type_info = "MPEG video (%s)" % type
|
||||
elif type in ['audio/mpeg']:
|
||||
type_info = "MP3 (%s)" % type
|
||||
else:
|
||||
type_info = "Unknown type (%s)" % type
|
||||
|
||||
|
@ -12,6 +12,7 @@ from .pptv import *
|
||||
from .qq import *
|
||||
from .sina import *
|
||||
from .sohu import *
|
||||
from .soundcloud import *
|
||||
from .tudou import *
|
||||
from .vimeo import *
|
||||
from .w56 import *
|
||||
|
31
you_get/downloader/soundcloud.py
Normal file
31
you_get/downloader/soundcloud.py
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__all__ = ['soundcloud_download', 'soundcloud_download_by_id']
|
||||
|
||||
from ..common import *
|
||||
|
||||
def soundcloud_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False):
|
||||
assert title
|
||||
|
||||
#if info["downloadable"]:
|
||||
# url = 'https://api.soundcloud.com/tracks/' + id + '/download?client_id=b45b1aa10f1ac2941910a7f0d10f8e28'
|
||||
url = 'https://api.soundcloud.com/tracks/' + id + '/stream?client_id=b45b1aa10f1ac2941910a7f0d10f8e28'
|
||||
assert url
|
||||
type, ext, size = url_info(url)
|
||||
|
||||
print_info(site_info, title, type, size)
|
||||
if not info_only:
|
||||
download_urls([url], title, ext, size, output_dir, merge = merge)
|
||||
|
||||
def soundcloud_download(url, output_dir = '.', merge = True, info_only = False):
|
||||
metadata = get_html('https://api.sndcdn.com/resolve.json?url=' + url + '&client_id=b45b1aa10f1ac2941910a7f0d10f8e28')
|
||||
import json
|
||||
info = json.loads(metadata)
|
||||
title = info["title"]
|
||||
id = str(info["id"])
|
||||
|
||||
soundcloud_download_by_id(id, title, output_dir, merge = merge, info_only = info_only)
|
||||
|
||||
site_info = "SoundCloud.com"
|
||||
download = soundcloud_download
|
||||
download_playlist = playlist_not_supported('soundcloud')
|
@ -34,6 +34,7 @@ def url_to_module(url):
|
||||
'sina': sina,
|
||||
'smgbb': bilibili,
|
||||
'sohu': sohu,
|
||||
'soundcloud': soundcloud,
|
||||
'tudou': tudou,
|
||||
'vimeo': vimeo,
|
||||
'yinyuetai': yinyuetai,
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__version__ = '0.3dev-20121209'
|
||||
__date__ = '2012-12-09'
|
||||
__version__ = '0.3dev-20121210'
|
||||
__date__ = '2012-12-10'
|
||||
|
Loading…
Reference in New Issue
Block a user