chibicitiberiu / ytsm

Self-hosted tool which manages your YouTube subscriptions, and downloads files automatically.
MIT License
316 stars 19 forks source link

Downloaded videos are 0 kb #92

Open gerroon opened 4 years ago

gerroon commented 4 years ago

For some reason the script borks and writes 0 kb videos with the errors below

Here is I am trying to download this

https://www.youtube.com/watch?v=lYOE5WMEAUk

INFO:scheduler:Added job "YtsmScheduler._run_job" to job store "default"                                                                                                                                           
2020-02-24 17:07:54,372 | scheduler | base.py:881 | INFO | Added job "YtsmScheduler._run_job" to job store "default"                                                                                               
INFO:scheduler:Removed job c18c684d0a1844af969677d5eb6aa47a                                                                                                                                                        
[24/Feb/2020 17:07:54] "POST /ajax/action/download_video_files/43988 HTTP/1.1" 200 17                                                                                                                              
2020-02-24 17:07:54,373 | scheduler | base.py:627 | INFO | Removed job c18c684d0a1844af969677d5eb6aa47a                                                                                                            
INFO:apscheduler.executors.default:Running job "YtsmScheduler._run_job (trigger: date[2020-02-24 17:07:54 UTC], next run at: 2020-02-24 17:07:54 UTC)" (scheduled at 2020-02-24 17:07:54.372653+00:00)             
2020-02-24 17:07:54,374 | apscheduler.executors.default | base.py:123 | INFO | Running job "YtsmScheduler._run_job (trigger: date[2020-02-24 17:07:54 UTC], next run at: 2020-02-24 17:07:54 UTC)" (scheduled at 20
20-02-24 17:07:54.372653+00:00)
[24/Feb/2020 17:07:55] "GET /ajax/get_running_jobs/ HTTP/1.1" 200 200
[24/Feb/2020 17:07:56] "GET /ajax/get_running_jobs/ HTTP/1.1" 200 200

ERROR:DownloadVideoJob.youtube_dl:ERROR:   Stream #1:0 -> #0:1 (copy)                                                                                                                                              
2020-02-24 16:57:14,839 | DownloadVideoJob.youtube_dl | YoutubeDL.py:522 | ERROR | ERROR:   Stream #1:0 -> #0:1 (copy)                                                                                             
CRITICAL:DownloadVideoJob:Job failed with exception: Traceback (most recent call last):                                                                                                                            
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2064, in post_process                                                                                              
    files_to_delete, info = pp.run(info)                                                                                                                                                                           
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 512, in run                                                                                             
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)                                                                                                                                  
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files                                                                       
    raise FFmpegPostProcessorError(msg)                                                                                                                                                                            
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError:   Stream #1:0 -> #0:1 (copy)                                                                                                                             

During handling of the above exception, another exception occurred:                                                                                                                                                

Traceback (most recent call last):                                                                                                                                                                                 
  File "/media/DRIVE/opt/ytsm/app/YtManagerApp/scheduler.py", line 245, in _run_job                                                                                                                              
    job_instance.run()                                                                                                                                                                                             
  File "/media/DRIVE/opt/ytsm/app/YtManagerApp/management/jobs/download_video.py", line 40, in run                                                                                                               
    ret = yt.download(["https://www.youtube.com/watch?v=" + self.__video.video_id])                                                                                                                                
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2018, in download                                                                                                  
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))                                                                                                                                
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 807, in extract_info                                                                                               
    return self.process_ie_result(ie_result, download, extra_info)                                                                                                                                                 
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 862, in process_ie_result                                                                                          
    return self.process_video_result(ie_result, download=download)                                                                                                                                                 
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1643, in process_video_result                                                                                      
    self.process_info(new_info)                                                                                                                                                                                    
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 1999, in process_info                                                                                              
    self.post_process(filename, info_dict)                                                                                                                                                                         
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2066, in post_process                                                                                              
    self.report_error(e.msg)
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 624, in report_error
    self.trouble(error_message, tb)
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 594, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR:   Stream #1:0 -> #0:1 (copy)

2020-02-24 16:57:14,843 | DownloadVideoJob | scheduler.py:249 | CRITICAL | Job failed with exception: Traceback (most recent call last):
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/YoutubeDL.py", line 2064, in post_process
    files_to_delete, info = pp.run(info)
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 512, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/media/DRIVE/opt/ytsm/.env/lib/python3.7/site-packages/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError:   Stream #1:0 -> #0:1 (copy)
chibicitiberiu commented 4 years ago

This looks like a problem with youtube-dl. Try updating it to the latest version.

YouTube changes things from time to time, which can break youtube-dl.

gerroon commented 4 years ago

Hi

I actually updated with no luck, I am on 2.16 version.

It seems to me that youtube-dl downloads the chunks but somehow those chunks are not put back as the final video and in return Ytsm thinks that the file is done and writes back a file of 0 kb. Because I see those chunks (those with .fXYZ) are still in the folders which normally cleanup by youtube-dl

gerroon commented 4 years ago

Btw this seems to happen only with some channels/videos but not all.