ajxv / animepahe-dlr

A python script to automate downloads from animepahe.
MIT License
4 stars 3 forks source link

Oops! <class 'requests.exceptions.ConnectionError'> occured. #22

Closed tusharbhatt959 closed 1 year ago

tusharbhatt959 commented 3 years ago

I am having this error, can you help me, what is wrong?

ajxv commented 3 years ago

Can you provide a screenshot of the error or specify at which point you encountered it ?

If it was while downloading, could be due to poor network connection.

tusharbhatt959 commented 3 years ago

image while searching for the anime

ajxv commented 3 years ago

Seems like a network issue. Maybe your ISP's blocking animepahe.com? I tried to reproduce the issue but the script was working fine. :(

If there is a network problem, such as refused connection and DNS failure, Requests will raise a ConnectionError exception

tusharbhatt959 commented 3 years ago

image

But in the browser, the site is working perfectly. Can you suggest me, what can i do to solve this issue.

tusharbhatt959 commented 3 years ago

Do i have to use mozilla firefox verion 90? image In user agent, its written firefox 90.0 but iam using 91.0

ajxv commented 3 years ago

Do i have to use mozilla firefox verion 90? image In user agent, its written firefox 90.0 but iam using 91.0

That shouldn't be an issue.

It seems the issue might be happening at line 113: index_page = requests.get(index_url). Can you open up python shell and confirm requests.get("https://animepahe.com/anime") is returning <Response [200]>

tusharbhatt959 commented 3 years ago

I did that but got the following error

import requests requests.get("https://animepahe.com/anime") Traceback (most recent call last): File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request( File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\Python39\lib\site-packages\urllib3\connection.py", line 411, in connect self.sock = ssl_wrapsocket( File "C:\Python39\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Python39\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Python39\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Python39\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Python39\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Python39\lib\site-packages\requests\adapters.py", line 439, in send resp = conn.urlopen( File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen retries = retries.increment( File "C:\Python39\lib\site-packages\urllib3\util\retry.py", line 532, in increment raise six.reraise(type(error), error, _stacktrace) File "C:\Python39\lib\site-packages\urllib3\packages\six.py", line 769, in reraise raise value.with_traceback(tb) File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn conn.connect() File "C:\Python39\lib\site-packages\urllib3\connection.py", line 411, in connect self.sock = ssl_wrapsocket( File "C:\Python39\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "C:\Python39\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "C:\Python39\lib\ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "C:\Python39\lib\ssl.py", line 1040, in _create self.do_handshake() File "C:\Python39\lib\ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Python39\lib\site-packages\requests\api.py", line 76, in get return request('get', url, params=params, kwargs) File "C:\Python39\lib\site-packages\requests\api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "C:\Python39\lib\site-packages\requests\sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "C:\Python39\lib\site-packages\requests\sessions.py", line 655, in send r = adapter.send(request, kwargs) File "C:\Python39\lib\site-packages\requests\adapters.py", line 498, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

tusharbhatt959 commented 3 years ago

image But when i do the same for google, it gives, <Response [200]>

And if i use, animepahe.org instead or .com it gives me this image

Can you tell me what might be the issue here

ajxv commented 3 years ago

And if i use, animepahe.org instead or .com it gives me this image

Can you tell me what might be the issue here

animepahe.org gives a 403 forbidden response. I guess its got something to do with cloudflares ddos guard.

But you should not be getting any errors with animepahe.com. It seems the server is refusing your request for some reason. I'll check if there's anything to be done in the script that would help fix this issue for you. In the meantime if you do find out what the issue might be, please do let me know. Also, if possible, check whether passing in some headers gives you a 200 response (use https://animepahe.com/anime instead of .org).

tusharbhatt959 commented 3 years ago

I checked but didn't got anything. And now the website sometimes doesn't even load on browser, i think it is something related to my connection. But animepahe.org and animepahe.ru sites are working, so is this possible to use animpahe.org or animepahe.ru, in your script?

ajxv commented 3 years ago

so is this possible to use animpahe.org or animepahe.ru, in your script?

Both' animepahe.ru' and '.org' returns a 403 forbidden status code (since they both use ddos guard). Therefore using those urls will be difficult. 'animepahe.com' is the only domain that doesn't use a ddos guard at the moment.

image

tusharbhatt959 commented 3 years ago

Thanks man for your time. I used a vpn and now its working fine. Although if you have some idea if I can pass DDOS-GUARD, in .org or .ru. please let me know, i will try it by myself. Otherwise the issue is resolved.

Again thanks a lot, for you help.

tusharbhatt959 commented 3 years ago

This issue is resolved but i faced another problem, when i search "Kimetsu no Yaiba" or "Demon slayer" it is showing - no matching anime found. Retry! image

image

ajxv commented 3 years ago

when i search "Kimetsu no Yaiba" or "Demon slayer" it is showing - no matching anime found. Retry!

It's an issue with capital letters. Thanks for pointing that out. I'll fix it in the next update.

ajxv commented 3 years ago

@tusharbhatt959 it seems all animepahe domains have adopted cloudflare's ddos guard. So the script may not work anymore. I am currently looking for a workaround. Will update if i find a solution.

haxsysgit commented 1 year ago

Try my version of animepahe-dlr : https://github.com/haxsysgit/autopahe