Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflare checking browser, Subscene query returning E503 #16

Open
radek555 opened this issue Jan 21, 2021 · 5 comments
Open

Cloudflare checking browser, Subscene query returning E503 #16

radek555 opened this issue Jan 21, 2021 · 5 comments
Labels

Comments

@radek555
Copy link

radek555 commented Jan 21, 2021

Hi,
recently subgrab stopped working for me. Today I digged a bit into what's wrong and after enabling DEBUG logging level, I got:

$ subgrab -m Titanic
DEBUG:SubGrab:Input with flags: ['subgrab', '-m', 'Titanic']
INFO:SubGrab:Initialized SubGrab script
INFO:SubGrab:Set Language: EN
INFO:SubGrab:Searching For: Titanic
INFO:subscene.py:Selecting title for name: Titanic
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): subscene.com:443
DEBUG:urllib3.connectionpool:https://subscene.com:443 "GET /subtitles/searchbytitle?query=Titanic HTTP/1.1" 503 None
DEBUG:subscene.py:https://subscene.com/subtitles/searchbytitle?query=Titanic not retrieved.
INFO:subscene.py:Searching in query: https://subscene.com/subtitles/searchbytitle/?query=Titanic
DEBUG:subscene.py:Returning - 'NoneType' object has no attribute 'find'
INFO:SubGrab:Subtitle Link for Titanic : None

I guess this is due to some protection mechanisms being enforced by subscene server, right? This is also evident when you go to subscene.com via browser, before loading the webpage, there is a banner saying

Checking your browser before accessing subscene.com.
This process is automatic. Your browser will redirect to your requested content shortly.
Please allow up to 5 seconds…
DDoS protection by Cloudflare

Is anyone going to fix this somehow and is that even possible?
Also, is it possible to use ALLSUBDB backend without actually computing the movie hash from media file, only using movie title?

Thanks!

@RafayGhafoor
Copy link
Owner

RafayGhafoor commented Jan 21, 2021

Thank you for notifying and this looks bad 😢 but we have a way to mitigate this issue. 😃

A workaround would be to use selenium and open a web-browser using your profile and save cookies obtained from subscene site. These cookies would be then read and set by the requests session for making requests to the site.

@radek555, Code snippet which I just tested to see if the browser allows access to subscene with my current profile is as follows and this would give you some pointers.

Subscene Cookies

I would be happy to guide you on this issue and would appreciate PR that could add this patch to subscene library.

@radek555
Copy link
Author

Hi,
thanks for the quick reply! I tried with selenium to get the cookies and then adding these cookies to requests.get(url, cookies=cookies) and it worked.

Unfortunately I don't have more time to fix this issue. I am sorry. Also I don't know how the integration of this selenium trick should look like in wrt. subgrab (command line argument, config file?). Maybe if you describe how this should be carried out, someone else can help.

@RafayGhafoor
Copy link
Owner

I will try to fix this issue when I have time as it's not persistent for everybody and the fix would introduce additional dependencies in the project :).

@RafayGhafoor RafayGhafoor changed the title Not downloading any subtitles, Subscene query returning E503 Cloudflare checking browser, Subscene query returning E503 Jan 23, 2021
@nakhla
Copy link

nakhla commented May 14, 2022

Hi, thanks for the quick reply! I tried with selenium to get the cookies and then adding these cookies to requests.get(url, cookies=cookies) and it worked.

Unfortunately I don't have more time to fix this issue. I am sorry. Also I don't know how the integration of this selenium trick should look like in wrt. subgrab (command line argument, config file?). Maybe if you describe how this should be carried out, someone else can help.

I am still getting Unable to make request. Status Code 403 even after fetching the cookies and adding them in the request, any idea to overcome this issue.
my simple project is also affected by this limitation from subscene. any idea is appreciated

@RafayGhafoor
Copy link
Owner

please post your code which is trying to make request using cookies so I can check what could be done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants