Page 1 of 1

requests.exceptions.TooManyRedirects API problem

Posted: Wed Dec 01, 2021 12:58 pm
by FlameCRO
Hello first of all thanks for all the hard work you provide to us.

I have a question regarding OS API regarding multiple language selection when searching new opensubtitles API
As stated in documentation language and string separated with , but obviously not working as to many redirects happen

This is the error i get

requests.exceptions.TooManyRedirects: Exceeded 30 redirects.

[*] payload = open_search.set_payload(moviehash=movie.file_hash, query=movie.title, imdb_id=movie.imdb_id, languages=lang, year=movie.year)[*]


https://github.com/razorblade23/Subtitl ... in.py#L364
Here is the Perma link to the code

Any help?

And regarding the forum and site, had to create a new account for this forum, aren't the forum and opensubtitles.org connected to same account?

Re: requests.exceptions.TooManyRedirects API problem

Posted: Fri Dec 03, 2021 12:51 pm
by oss
Hi,

it is always good idea to actually write what you are searching, because it can be different error, and hard to understand from your text.

This works:

Code: Select all

curl -v -X GET 'https://api.opensubtitles.com//api/v1/subtitles?languages=fr,en&query=new.amsterdam.2018.s01e01.720p.hdtv.x264-syncopy.mkv' --header 'Api-Key: {api_key}'
write your code which doesnt work

for account - forum.opensubtitles.org and www.opensubtitles.org are using different accounts, and also www.opensubtitles.com is different (you have to import account from www.opensubtitles.org into www.opensubtitles.com) - we are moving everything (forum, blog...) on .com domain, where everything will work, like one would expect :)

Re: requests.exceptions.TooManyRedirects API problem

Posted: Fri Dec 03, 2021 1:28 pm
by FlameCRO
No matter if it's a tv show episode or a movie, searching for multiple languages at once doesn't work for me. Keep in mind when searching for a single language - it works, but selecting more languages ie en, hr two languages u get that to many redirects error

This works,

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?imdb_id=120744&languages=hr&moviehash=fbba534c1cc7d654&query=the+man+in+the+iron+mask&year=1998

Code: Select all

{'moviehash': 'fbba534c1cc7d654', 'query': 'The Man In The Iron Mask', 'imdb_id': '0120744', 'languages': 'hr', 'year': 1998}

But this gets me to many redirects

Code: Select all

{'moviehash': 'fbba534c1cc7d654', 'query': 'The Man In The Iron Mask', 'imdb_id': '0120744', 'languages': 'hr,en', 'year': 1998}

As stated in api's documentation, language codes separated with , should work.. not in my case. What am I doing wrong?


Edit: apparently i was mistyping some stuff. It works now!
Thank you


Another question, i just did the import account.
The old account works on opensubtitles.org and opensubtitles.com but not on forum.opensubtitles.org
It just works the one i created two days ago, is the problem present cause i used the same account and email like on old site to create on forum?

Re: requests.exceptions.TooManyRedirects API problem

Posted: Tue Dec 14, 2021 12:24 pm
by oss
forum users another accounts, so yeah, you have to have 3 accounts for now. This will going to change with new system, where it will be all interconnected (and opensubtitles.org will be later turned off)

I hope all works for you.