wolfswolke / aniworld_scraper

Aniworld.to mp4 scraper for animes.
MIT License
49 stars 16 forks source link

Exception in thread Thread 4 [BUG] #23

Closed flatko closed 7 months ago

flatko commented 8 months ago

The program downloaded episodes 1- 73 of the anime "Monster" from aniworld without a problem but somehow it wont download the last episode.

Screenshot 2023-10-26 182910

wolfswolke commented 8 months ago

The issue probably is that windows doesn´t allow a process to have that many threads at once. Can you please try the Manual downloader for the last episode?

flatko commented 8 months ago

Same issue.

wolfswolke commented 8 months ago

That doesnt make any sense. Did you try restarting your PC? I tested it on 3 devices and i can download all episodes and the last one manualy no issues. Are you maybe using a outdated version of this project? Maybe you are using the Microsoft Store verion of python? image

flatko commented 8 months ago

Nah i downloaded this project like a day before this thread. I got Python from the website. The cmd is also instantly closing, without recording a clip u cant even read the errormsg

wolfswolke commented 8 months ago

Dumb idea but try this. Open CMD, run powershell in that window and then run the scraper. In theory you have 2 instances running and python could only close the first one. Please submit the error message then.

flatko commented 8 months ago

Its the exact same message. Even on another series it downloads everything but the last episode. i reinstalled python and the scraper.

wolfswolke commented 7 months ago

Can you please enable Debug Loggin (start_app -> Line 84 setup_logging("debug")) and also in "downloader.py" before Line 47 add "print(ffmpeg_cmd)". After that upload the Output again please.

flatko commented 7 months ago

PS G:\Anime\aniworld_scraper-V-1.9\src> python .\start_app.py 2023-11-14 16:56:49,232: INFO ------------- AnimeSerienScraper v01-09-00 started ------------ 2023-11-14 16:56:49,232: DEBUG start_app.py -> We have Read Permission 2023-11-14 16:56:49,232: DEBUG start_app.py -> We have Write Permission 2023-11-14 16:56:49,232: INFO start_app.py -> No Season override detected. 2023-11-14 16:56:49,232: DEBUG collect_all_seasons_and_episodes.py -> Entered get_season. 2023-11-14 16:56:49,232: DEBUG collect_all_seasons_and_episodes.py -> Site URL is: https://aniworld.to/anime/stream/nichijou-my-ordinary-life/ 2023-11-14 16:56:49,608: DEBUG collect_all_seasons_and_episodes.py -> Now leaving Function get_season 2023-11-14 16:56:49,608: INFO start_app.py -> We have this many seasons: 1 2023-11-14 16:56:49,608: DEBUG collect_all_seasons_and_episodes.py -> Entered get_episodes 2023-11-14 16:56:49,978: DEBUG collect_all_seasons_and_episodes.py -> Now leaving Function get_episodes 2023-11-14 16:56:49,979: INFO start_app.py -> Season 1 has 26 Episodes.

(few lines of "not downloading because file already downloaded)

2023-11-14 16:56:49,999: INFO start_app.py -> File name will be: nichijou-my-ordinary-life/Season 01/nichijou-my-ordinary-life - s01e26 - Ger-Sub.mp4 2023-11-14 16:56:49,999: DEBUG downloader.py -> File not downloaded. Downloading: nichijou-my-ordinary-life/Season 01/nichijou-my-ordinary-life - s01e26 - Ger-Sub.mp4 2023-11-14 16:56:50,203: DEBUG search_for_links.py ->Link to redirect is: https://aniworld.to/redirect/1803681 2023-11-14 16:56:50,203: DEBUG start_app.py -> Entered DDOS var check and starting new downloader. 2023-11-14 16:56:50,203: DEBUG search_for_links.py ->Enterd VOE to cache 2023-11-14 16:56:51,064: DEBUG search_for_links.py ->Exiting VOE to Cache 2023-11-14 16:56:51,064: DEBUG startapp.py -> VOE Cache URL is: https://delivery-node-evsoaawruxp0d7hl.voe-network.net/engine/hls2/01/09030/fhftlvthjlf0,n,.urlset/master.m3u8?t=wAXbRNrppGxA7F-lgqIuN39Ohf4s2gTeoCXu8Qj2W0&s=1699977410&e=14400&f=45154460&node=delivery-node-evsoaawruxp0d7hl.voe-network.net&i=77.21&sp=2500&asn=3209 2023-11-14 16:56:51,065: DEBUG downloader.py -> Entered Downloader. 2023-11-14 16:56:51,067: INFO downloader.py -> File nichijou-my-ordinary-life/Season 01/nichijou-my-ordinary-life - s01e26 - Ger-Sub.mp4 added to queue. ['ffmpeg', '-i', 'https://delivery-node-evsoaawruxp0d7hl.voe-network.net/engine/hls2/01/09030/fhftlvthjlf0,n,.urlset/master.m3u8?t=wAXbRNrppGxA7F-lgqIuN39Ohf4_s2gTeoCXu8Qj2W0&s=1699977410&e=14400&f=45154460&node=delivery-node-evsoaawruxp0d7hl.voe-network.net&i=77.21&sp=2500&asn=3209', '-c', 'copy', 'nichijou-my-ordinary-life/Season 01/nichijou-my-ordinary-life - s01e26 - Ger-Sub.mp4'] Exception in thread Thread-1 (download_and_convert_hls_stream): Traceback (most recent call last): File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1052, in _bootstrap_inner self.run() File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 989, in run self._target(*self._args, **self._kwargs) File "G:\Anime\aniworld_scraper-V-1.9\src\logic\downloader.py", line 48, in download_and_convert_hls_stream subprocess.run(ffmpeg_cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 550, in run stdout, stderr = process.communicate(input, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1209, in communicate stdout, stderr = self._communicate(input, endtime, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1610, in _communicate self.stdout_thread.start() File "C:\Users\wladi\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 971, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't create new thread at interpreter shutdown PS G:\Anime\aniworld_scraper-V-1.9\src>

flatko commented 7 months ago

ah shit, sorry i know its pretty late, but i had to install ffmpeg manually and i renamed the ffmpeg.exe to _ffmpeg.exe because else i had the same problem as the guy in the other thread. maybe its because of this (even though the error message doenst mention ffmpeg). sry again.

wolfswolke commented 7 months ago

Its a pretty high chance that the installed version of ffmpeg is fighting the "portable" version. Can you try downloading the latest version and putting that where the ffmpeg.exe is? https://github.com/BtbN/FFmpeg-Builds/releases

flatko commented 7 months ago

If you mean your provided ffmpeg.exe, it wasnt working for me. thats why i renamed it to test it with the installed version. only then the scraper even worked.

with the new ffmpeg.exe its still the same outcome.

btw i just noticed that "your" ffmpeg.exe is only 1kb while the new one is 126mb big, maybe thats why it wasnt working with yours.

wolfswolke commented 7 months ago

I finally found out why the included ffmpeg has this issue... Github wants me to buy bandwidth... I will write a script that downloads it from the offical website .-. grafik

wolfswolke commented 7 months ago

Im still not able to recreate this issue. The only things i can think about is: uninstalling FFMPEG and downloading it from the github link i send you or trying to join Threads on your PC: DOWNLOADER.PY LINE 58

    if provider in ["Vidoza","Streamtape"]:
        download_thread = threading.Thread(target=download, args=(url, file_name))
        download_thread.start()
        download_thread.join()
    elif provider == "VOE":
        download_thread = threading.Thread(target=download_and_convert_hls_stream, args=(url, file_name)).
        download_thread.start()
        download_thread.join()
flatko commented 7 months ago

Nah i dont think it was a ffmpeg problem, beside the issue you had with github. My PC is just weird :D. The change in downloader.py actually fixed it!

But now i had a another weird problem. I started the scraper to download last episode (17/17) of "jujutsu kaisen", which was released few days ago. It went well, without an error (also tryed on another series to verify). But i then noticed, that ep16 was only partly downloaded (with ~100mb instead of 2xx mb). So i deleted ep16 and ran the scraper and this happend:

image (edit: same thing with manual downloader)

It seems to be an issue with that VOE upload only. So is there a way to chose another hoster? From my little understanding of the code above, he should try another hoster (but isnt?).

wolfswolke commented 7 months ago

You can change the order of hosts in search_for_links.py get_redirect_link_by_provider. This issue has happend once and that was when Vidoza/VOE has Maintanance. Issue:21 I dont know why this happens here. Its probably because either a "DDOS/Scraping" Protection triggers or they had Server Issues.