kylon / Sharedown

Electron application to download Sharepoint videos (especially meant for students)
GNU General Public License v3.0
376 stars 41 forks source link

Download failed YT-dlp error: Exit code: 1 (but only on certain videos)) #9

Closed theRAGEhero closed 2 years ago

theRAGEhero commented 3 years ago

Hello and thank you for Sharedown, the software is working well but I cannot download some videos.

I receive this error:

Download failed 
YT-dlp error: 
Exit code: 1

It's weird because it happens only on some videos while I don't have any problems with the others. There shouldn't be any significance difference between the videos that are working and the videos that are not.

Here the last lines of the logs.

ytdlp log: `

  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/yt-dlp/__main__.py", line 19, in <module>
    yt_dlp.main()
  File "/usr/local/bin/yt-dlp/yt_dlp/__init__.py", line 776, in main
    _real_main(argv)
  File "/usr/local/bin/yt-dlp/yt_dlp/__init__.py", line 766, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2894, in download
    res = self.extract_info(
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1207, in extract_info
    return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1214, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1252, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 1298, in process_ie_result
    ie_result = self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2320, in process_video_result
    self.process_info(new_info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 717, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 237, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 274, in real_run_ffmpeg
    self.report_error(stderr)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 56, in report_error
    return self._downloader.report_error(text, *args, **kwargs)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 818, in report_error
    self.trouble(error_message, tb)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 774, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

ERROR: Postprocessing: file:/home/ale/Downloads/sharedownVideos/sharedownTmp/VIDEO.fvcopy.mp4: Operation not permitted
Traceback (most recent call last):
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2864, in process_info
    info_dict = self.post_process(dl_filename, info_dict, files_to_move)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 3015, in post_process
    info = self.run_pp(pp, info)
  File "/usr/local/bin/yt-dlp/yt_dlp/YoutubeDL.py", line 2964, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/common.py", line 83, in wrapper
    return func(self, info)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 717, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 237, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "/usr/local/bin/yt-dlp/yt_dlp/postprocessor/ffmpeg.py", line 275, in real_run_ffmpeg
    raise FFmpegPostProcessorError(stderr.split('\n')[-1])
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: file:/home/ale/Downloads/sharedownVideos/sharedownTmp/VIDEO.fvcopy.mp4: Operation not permitted

Thank you in advance

kylon commented 3 years ago

hi,

this is not a sharedown issue, its yt-dlp issue or ffmpeg issue

try to update both ffmpeg and yt-dlp, if you are using an older version, also you may want to try to switch to ffmpeg instead of yt-dlp and see if that works (you can do this in sharedown settings)

Timsword commented 3 years ago

Hi,

I knw this isn't the place to ask it but did anyone manage to find a solution? I searched on the internet but most of pages says I need to upgrade yt-dl. but the thing is I installed it just now. So it's pretty current.

pavlodrizd commented 3 years ago

Hi,

I knw this isn't the place to ask it but did anyone manage to find a solution? I searched on the internet but most of pages says I need to upgrade yt-dl. but the thing is I installed it just now. So it's pretty current.

Same problem, can't download most part of the material. Any fixes?

kylon commented 3 years ago

have you tried ffmpeg instead of yt-dlp?

pavlodrizd commented 3 years ago

have you tried ffmpeg instead of yt-dlp?

yep, just did that

kylon commented 3 years ago

ffmpeg not working? do you get any error?

pavlodrizd commented 3 years ago

Ah no, I'm sorry, it's giving me the same 100%: Download failed YT-dlp error: Exit code: 1

I dont't understand why if in the settings I put ffmpeg. But okk

kylon commented 3 years ago

you must press save to apply the changes

pavlodrizd commented 3 years ago

restarted everything and saved, let's see thanks

Timsword commented 3 years ago

have you tried ffmpeg instead of yt-dlp?

Do you think is there is a way to fix yt-dl? ffmpeg is working perfectly fine on me but as you mentioned before, its pretty slower than yt-dl.

kylon commented 3 years ago

sure, if ffmpeg is working, it is just a matter of not doing whatever yt-dlp does to create the video

i ll open an issue in yt-dlp git

@Timsword a verbose log is required, i need to add an option for that first, unless you can produce one via cmd?

Timsword commented 3 years ago

To be honest, I don't know what it actually is. I will research on the internet about it..

Thank you very much for everything.

kylon commented 3 years ago

@Timsword

this version will only print yt-dlp logs as needed by yt-dlp dev enable logs in sharedown settings, and download a video that fails with yt-dlp remove your data from logs (token, name etc..) and upload it

to run this version: (i suppose windows)

install nodejs: download (enable download additional components) extract sharedown open cmd or powershell in sharedown folder type npm i and run the command

when ready, type npm start to run sharedown

sharedown-ytdlp-log.zip

andresaliba commented 3 years ago

I took a look at the code but it's a bit too complex for me. I found the catch on preload.js at line 488, which I believe is the one that throws this error. Is it possible to make the Start Download function run again after this error is thrown? This would help downloading files over night.

kylon commented 3 years ago

yes, i will add a 'retry on failure' option

tipicoenlauniFB commented 3 years ago

I think it is an Onedrive protection action, because when I donwload any video using yt-dlp y get this error on the next video, so Throttle blocks temporarily all requests to Onedrive.

trooo

So I prefer to use ffmpeg to avoid errors.

kylon commented 3 years ago

just noticed this..https://github.com/yt-dlp/FFmpeg-Builds this could fix yt-dlp errors, can someone with yt-dlp ffmpeg errors please test?

casvis95 commented 3 years ago

just noticed this..https://github.com/yt-dlp/FFmpeg-Builds this could fix yt-dlp errors, can someone with yt-dlp ffmpeg errors please test?

Hello, I'm still having this issue :( I have only if I use YT-DLP to download my videos, if I select FFmpeg the download speed is very slow but it works fine.

JohnnyLAmpAz commented 3 years ago

I get consistently this error downloading a particular video, at a particular dowload %:

[download]  99.9% of ~365.19MiB at 283.81KiB/s ETA 00:00 (frag 1169/1171)
[download]  99.9% of ~365.19MiB at 282.51KiB/s ETA 00:00 (frag 1170/1171)
[download] Got server HTTP error: HTTP Error 500: Internal Server Error. Retrying (attempt 1 of 10) ...

[...]

[download] Got server HTTP error: HTTP Error 500: Internal Server Error. Retrying (attempt 10 of 10) ...

ERROR: giving up after 10 retries

  File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 80, in _worker
    work_item.run()
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 474, in _download_fragment
    frag_content, frag_index = download_fragment(fragment, ctx_copy)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 427, in download_fragment
    success, frag_content = self._download_fragment(ctx, fragment['url'], info_dict, headers)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 132, in _download_fragment
    success = ctx['dl'].download(fragment_filename, fragment_info_dict)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 399, in download
    ret = self.real_download(filename, info_dict)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/http.py", line 386, in real_download
    self.report_error('giving up after %s retries' % retries)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 172, in report_error
    self.ydl.report_error(*args, **kargs)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 881, in report_error
    self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', tb)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 820, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())

ERROR: unable to download video data: [Errno 2] No such file or directory: 'VIDEO_DIR_PATH/sharedownTmp/VIDEO_NAME.fvcopy.mp4-Frag1171'

Traceback (most recent call last):
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2836, in process_info
    partial_success, real_download = self.dl(fname, new_info)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 2578, in dl
    return fd.download(name, new_info, subtitle)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/common.py", line 399, in download
    ret = self.real_download(filename, info_dict)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/dash.py", line 62, in real_download
    return self.download_and_append_fragments(ctx, fragments_to_download, info_dict)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 479, in download_and_append_fragments
    for fragment, frag_content, frag_index, frag_filename in pool.map(_download_fragment, fragments):
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 619, in result_iterator
    yield fs.pop().result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 474, in _download_fragment
    frag_content, frag_index = download_fragment(fragment, ctx_copy)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 427, in download_fragment
    success, frag_content = self._download_fragment(ctx, fragment['url'], info_dict, headers)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 138, in _download_fragment
    return True, self._read_fragment(ctx)
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/downloader/fragment.py", line 141, in _read_fragment
    down, frag_sanitized = sanitize_open(ctx['fragment_filename_sanitized'], 'rb')
  File "/home/lorenzo/.local/lib/python3.8/site-packages/yt_dlp/utils.py", line 2094, in sanitize_open
    stream = open(encodeFilename(filename), open_mode)
FileNotFoundError: [Errno 2] No such file or directory: 'VIDEO_DIR_PATH/sharedownTmp/VIDEO_NAME.fvcopy.mp4-Frag1171'

just noticed this..https://github.com/yt-dlp/FFmpeg-Builds this could fix yt-dlp errors, can someone with yt-dlp ffmpeg errors please test?

I tried to replace my installation (ffmpeg-4.3.1-amd64-static) with that repo's latest release ffmpeg-N-104591-g8c150d3d97-linux64-gpl, but the same error occured, still at the same dl%.

After searching I found that the error I'm getting is related to youtube-dl and there is an open issue about that. Problems with video formats? Idk.

With other videos, after occasional errors (not this i think, didn't looked at logs :man_facepalming: ), I managed to download them simply by retrying.

kylon commented 2 years ago

yes, it is a known issue, use ffmpeg or direct for that

kylon commented 2 years ago

still valid? latest yt-dlp should fix random fails

kylon commented 2 years ago

closing for inactivity, if the problem persists, make sure to install latest yt-dlp and sharedown and open a new issue