Page 5 of 9

Re: [OS] Brand new REST API for testing

Posted: Fri Sep 17, 2021 8:57 am
by os_dev
so you are asking about the typo, or the functionality ?

Re: [OS] Brand new REST API for testing

Posted: Sat Oct 09, 2021 3:55 pm
by shleemypants
so you are asking about the typo, or the functionality ?
I just wanted to make sure if it was a typo.

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 02, 2021 11:10 am
by vankasteelj
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.

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 02, 2021 11:22 am
by os_dev
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...

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 02, 2021 2:03 pm
by vankasteelj
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.

Re: [OS] Brand new REST API for testing

Posted: Mon Nov 15, 2021 11:10 pm
by shleemypants
Hello again,
This is my wrapper for .NET: https://github.com/moviecollection/open-subtitles

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 16, 2021 2:30 am
by oss
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

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 16, 2021 1:20 pm
by shleemypants
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.

Re: [OS] Brand new REST API for testing

Posted: Wed Nov 17, 2021 12:07 am
by oss
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.

Re: [OS] Brand new REST API for testing

Posted: Wed Nov 17, 2021 7:09 pm
by shleemypants
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.

Re: [OS] Brand new REST API for testing

Posted: Sat Nov 20, 2021 12:56 pm
by MBR-0001
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:

Re: [OS] Brand new REST API for testing

Posted: Sun Nov 21, 2021 2:38 pm
by oss
you are totally right. Status page is somehow broken :)

Re: [OS] Brand new REST API for testing

Posted: Sun Nov 21, 2021 6:01 pm
by os_dev
:roll: ooops

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

Re: [OS] Brand new REST API for testing

Posted: Thu Dec 02, 2021 3:29 pm
by MBR-0001
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?

Re: [OS] Brand new REST API for testing

Posted: Fri Dec 03, 2021 9:39 am
by oss
understood, working on solution somehow. for 503, you can implement 0.5 second retry interval, max 3 retries.