Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
os_dev
Posts: 194
Joined: Wed Oct 17, 2018 3:42 pm

Re: [OS] Brand new REST API for testing

Fri Sep 17, 2021 8:57 am

so you are asking about the typo, or the functionality ?

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Sat Oct 09, 2021 3:55 pm

so you are asking about the typo, or the functionality ?
I just wanted to make sure if it was a typo.
Last edited by shleemypants on Sat Oct 09, 2021 3:57 pm, edited 1 time in total.

User avatar
vankasteelj
Posts: 175
Joined: Sun Nov 15, 2015 1:09 am

Re: [OS] Brand new REST API for testing

Tue Nov 02, 2021 11:10 am

I've made a nodejs wrapper: https://github.com/vankasteelj/opensubtitles.com

But the /download endpoint doesn't seem to work. On the mock server, it's ok. On the actual server, I only get a 406 (Not acceptable) response.

os_dev
Posts: 194
Joined: Wed Oct 17, 2018 3:42 pm

Re: [OS] Brand new REST API for testing

Tue Nov 02, 2021 11:22 am

I've made a nodejs wrapper: https://github.com/vankasteelj/opensubtitles.com

But the /download endpoint doesn't seem to work. On the mock server, it's ok. On the actual server, I only get a 406 (Not acceptable) response.
what do you mean by mock/actual server ?

the endpoints are working, I can try to help out if you give me some debug information (your failing request, headers and the full response you get)

or get the endpoint working with insomnia or postman, and try to figure out by yourself...

User avatar
vankasteelj
Posts: 175
Joined: Sun Nov 15, 2015 1:09 am

Re: [OS] Brand new REST API for testing

Tue Nov 02, 2021 2:03 pm

Ok I've got the issue, I've got to include the header `Accept: '*/*'` otherwise it doesn't work with /download. Every other endpoint does work without that header though.

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Mon Nov 15, 2021 11:10 pm

Hello again,
This is my wrapper for .NET: https://github.com/moviecollection/open-subtitles

User avatar
oss
Site Admin
Posts: 5878
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: [OS] Brand new REST API for testing

Tue Nov 16, 2021 2:30 am

ok, it is nice, I published it on our list
https://opensubtitles.stoplight.io/docs ... g-this-api

just couple of stuff:
1) make sure you set up http useragent for example as ".NET OS API v0.1" or something, so I see it is used. Next thing, read new docs, I just changed it, you will find out some interesting stuff, like:

For faster response to avoid HTTP redirection:
* send GET parameters **alphabetically** sorted
* send GET parameters and values in **lowercase**
* in GET values remove "tt" from IMDB ID & remove leading 0 in any "ID" parameters,
* there is no need to send default values, they will be deleted

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Tue Nov 16, 2021 1:20 pm

ok, it is nice, I published it on our list
https://opensubtitles.stoplight.io/docs ... g-this-api

just couple of stuff:
1) make sure you set up http useragent for example as ".NET OS API v0.1" or something, so I see it is used. Next thing, read new docs, I just changed it, you will find out some interesting stuff, like:

For faster response to avoid HTTP redirection:
* send GET parameters **alphabetically** sorted
* send GET parameters and values in **lowercase**
* in GET values remove "tt" from IMDB ID & remove leading 0 in any "ID" parameters,
* there is no need to send default values, they will be deleted
Thanks.
Shouldn't every app that uses this library have their own useragent? I don't think I should set the useragent.

User avatar
oss
Site Admin
Posts: 5878
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: [OS] Brand new REST API for testing

Wed Nov 17, 2021 12:07 am

Hi

it is good you set this useragent in Wrapper and in instructions to wrapper you just write, that everybody (developer) should change it to its own UA. This is pure for tracking it in logs (debugging), it is not used for anything else, otherwise it is harder to debug.

shleemypants
Posts: 10
Joined: Thu Sep 09, 2021 2:28 pm

Re: [OS] Brand new REST API for testing

Wed Nov 17, 2021 7:09 pm

Hi

it is good you set this useragent in Wrapper and in instructions to wrapper you just write, that everybody (developer) should change it to its own UA. This is pure for tracking it in logs (debugging), it is not used for anything else, otherwise it is harder to debug.
Sure. In that case I'll force the users to provide a useragent.
Thanks.

MBR-0001
Posts: 13
Joined: Wed Oct 06, 2021 4:02 pm

Re: [OS] Brand new REST API for testing

Sat Nov 20, 2021 12:56 pm

What's the status of the API? The status page says its been down for almost a month now but it works fine from what I've seen :/

If the status page is broken is there gonna be a status page for the status page? :lol:

User avatar
oss
Site Admin
Posts: 5878
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: [OS] Brand new REST API for testing

Sun Nov 21, 2021 2:38 pm

you are totally right. Status page is somehow broken :)

os_dev
Posts: 194
Joined: Wed Oct 17, 2018 3:42 pm

Re: [OS] Brand new REST API for testing

Sun Nov 21, 2021 6:01 pm

:roll: ooops

ok it's working again, thanks for telling me !

MBR-0001
Posts: 13
Joined: Wed Oct 06, 2021 4:02 pm

Re: [OS] Brand new REST API for testing

Thu Dec 02, 2021 3:29 pm

Another issue has appeared :(

I found out that the HttpClient in .NET forces uppercase letters for percent encoding special characters - this causes redirect loops

example: https://dotnetfiddle.net/OB7Z0K

in that example the query is mythbusters%20-%20die%20wissensj%c3%a4ger (which is valid) but the HttpClient internally changes that to mythbusters%20-%20die%20wissensj%C3%A4ger (which is invalid according to your api)

which makes it end up in a redirect loop (because the client always changes the letters to uppercase)
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
Moved: /api/v1/subtitles?query=mythbusters%20-%20die%20wissensj%c3%a4ger
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
Moved: /api/v1/subtitles?query=mythbusters%20-%20die%20wissensj%c3%a4ger
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
Moved: /api/v1/subtitles?query=mythbusters%20-%20die%20wissensj%c3%a4ger
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
Moved: /api/v1/subtitles?query=mythbusters%20-%20die%20wissensj%c3%a4ger
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
Moved: /api/v1/subtitles?query=mythbusters%20-%20die%20wissensj%c3%a4ger
GET https://api.opensubtitles.com/api/v1/su ... j%c3%a4ger
The RFC 3986 (https://www.rfc-editor.org/rfc/rfc3986#section-2.1) states
The uppercase hexadecimal digits 'A' through 'F' are equivalent to
the lowercase digits 'a' through 'f', respectively. If two URIs
differ only in the case of hexadecimal digits used in percent-encoded
octets, they are equivalent
Is there any chance you could change the API to allow the percent encoded characters to be uppercase? There's literally no way to fix this from our side (jellyfin plugin, https://github.com/moviecollection/open-subtitles is affected by this issue too)

Thanks

EDIT: I also noticed that there's a lot of 502 bad gateway responses, is this a temporary thing or should I add handling for this specific status code in the plugin code?

User avatar
oss
Site Admin
Posts: 5878
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

Re: [OS] Brand new REST API for testing

Fri Dec 03, 2021 9:39 am

understood, working on solution somehow. for 503, you can implement 0.5 second retry interval, max 3 retries.

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 32 guests