mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 11:42:30 +03:00
Merge remote-tracking branch 'upstream/master' into upstream
This commit is contained in:
commit
57f668198a
@ -1,6 +1,13 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.3.5
|
||||
-----
|
||||
|
||||
*Date: 2013-03-15*
|
||||
|
||||
* Default to use FFmpeg for merging .flv files.
|
||||
|
||||
0.3.4
|
||||
-----
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# You-Get [![Build Status](https://api.travis-ci.org/soimort/you-get.png)](https://travis-ci.org/soimort/you-get)
|
||||
# You-Get
|
||||
|
||||
[![Build Status](https://api.travis-ci.org/soimort/you-get.png)](https://travis-ci.org/soimort/you-get)
|
||||
|
||||
[You-Get](https://github.com/soimort/you-get) is a video downloader runs on Python 3. It aims at easing the download of videos on [YouTube](http://www.youtube.com), [Youku](http://www.youku.com)/[Tudou](http://www.tudou.com) (biggest online video providers in China), [ Niconico](http://www.nicovideo.jp), etc., in one script.
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
You-Get
|
||||
=======
|
||||
|
||||
.. image:: https://api.travis-ci.org/soimort/you-get.png
|
||||
|
||||
`You-Get <https://github.com/soimort/you-get>`_ is a video downloader runs on Python 3. It aims at easing the download of videos on `YouTube <http://www.youtube.com>`_, `Youku <http://www.youku.com>`_/`Tudou <http://www.tudou.com>`_ (biggest online video providers in China), `Niconico <http://www.nicovideo.jp>`_, etc., in one script.
|
||||
|
||||
See the project homepage http://www.soimort.org/you-get for further documentation.
|
||||
|
@ -409,10 +409,20 @@ def download_urls(urls, title, ext, total_size, output_dir = '.', refer = None,
|
||||
print()
|
||||
return
|
||||
if ext == 'flv':
|
||||
from .processor.join_flv import concat_flv
|
||||
concat_flv(parts, os.path.join(output_dir, title + '.flv'))
|
||||
for part in parts:
|
||||
os.remove(part)
|
||||
try:
|
||||
from .processor.ffmpeg import has_ffmpeg_installed
|
||||
if has_ffmpeg_installed():
|
||||
from .processor.ffmpeg import ffmpeg_concat_flv_to_mp4
|
||||
ffmpeg_concat_flv_to_mp4(parts, os.path.join(output_dir, title + '.mp4'))
|
||||
else:
|
||||
from .processor.join_flv import concat_flv
|
||||
concat_flv(parts, os.path.join(output_dir, title + '.flv'))
|
||||
except:
|
||||
raise
|
||||
else:
|
||||
for part in parts:
|
||||
os.remove(part)
|
||||
|
||||
elif ext == 'mp4':
|
||||
try:
|
||||
from .processor.join_mp4 import concat_mp4
|
||||
@ -428,6 +438,7 @@ def download_urls(urls, title, ext, total_size, output_dir = '.', refer = None,
|
||||
os.remove(part)
|
||||
else:
|
||||
print('No ffmpeg is found. Merging aborted.')
|
||||
|
||||
else:
|
||||
print("Can't merge %s files" % ext)
|
||||
|
||||
|
@ -60,3 +60,28 @@ def ffmpeg_concat_ts_to_mkv(files, output = 'output.mkv'):
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
def ffmpeg_concat_flv_to_mp4(files, output = 'output.mp4'):
|
||||
for file in files:
|
||||
if os.path.isfile(file):
|
||||
params = ['ffmpeg', '-i']
|
||||
params.append(file)
|
||||
params += ['-map', '0', '-c', 'copy', '-f', 'mpegts', '-bsf:v', 'h264_mp4toannexb']
|
||||
params.append(file + '.ts')
|
||||
|
||||
subprocess.call(params)
|
||||
|
||||
params = ['ffmpeg', '-i']
|
||||
params.append('concat:')
|
||||
for file in files:
|
||||
f = file + '.ts'
|
||||
if os.path.isfile(f):
|
||||
params[-1] += f + '|'
|
||||
params += ['-c', 'copy', '-absf', 'aac_adtstoasc', output]
|
||||
|
||||
if subprocess.call(params) == 0:
|
||||
for file in files:
|
||||
os.remove(file + '.ts')
|
||||
return True
|
||||
else:
|
||||
raise
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
__all__ = ['__version__', '__date__']
|
||||
|
||||
__version__ = '0.3.4'
|
||||
__date__ = '2013-03-08'
|
||||
__version__ = '0.3.5'
|
||||
__date__ = '2013-03-15'
|
||||
|
Loading…
Reference in New Issue
Block a user