Page 2 of 9

Re: [OS] Brand new REST API for testing

Posted: Sat Sep 05, 2020 8:14 pm
by abdalaoe
Hi there!
I made a golang library to access this new API rest here :https://github.com/TheForgotten69/go-opensubtitles

Re: [OS] Brand new REST API for testing

Posted: Wed Sep 09, 2020 11:30 am
by oss
very nice and thanks, I added this to newly created wiki page (it will change later) here

https://trac.opensubtitles.org/projects ... singAPInew

if somebody have also some libraries, wrappers etc which is using new API, let me know

Re: [OS] Brand new REST API for testing

Posted: Fri Oct 02, 2020 5:38 pm
by os_dev
Just a little note, I had to do a little name changing in the files section, I replaced the "id" by "file_id"

I added a changelog to the documentation
https://www.opensubtitles.com/docs/api/ ... #changelog

Re: [OS] Brand new REST API for testing

Posted: Fri Oct 09, 2020 4:35 pm
by Redbirdie
The new REST API looks so much more developer friendly and simple than the old one.

But the author fails to mention about how long after authentication the authorised token will remain valid, will it remain valid for the lifetime or it will get expired after some few mins/hrs..? Do we need to authenticate with username abs password all the time to acquire the token after it got expired... which in my opinion is not so convenient,

Looking forward to a fast response,
Thank you

Re: [OS] Brand new REST API for testing

Posted: Sun Oct 11, 2020 12:45 am
by os_dev
The new REST API looks so much more developer friendly and simple than the old one.

But the author fails to mention about how long after authentication the authorised token will remain valid, will it remain valid for the lifetime or it will get expired after some few mins/hrs..? Do we need to authenticate with username abs password all the time to acquire the token after it got expired... which in my opinion is not so convenient,

Looking forward to a fast response,
Thank you
For now the expiration is set to 24 hours, as it might change my recommandation would be to have a system in place that refreshes the token once a query gets a 401 response.

Re: [OS] Brand new REST API for testing

Posted: Tue Nov 10, 2020 4:39 pm
by os_dev
Hi everyone !

There's been some updates on the API, endpoint simplification, and a change of authentication mechanism: now you'll get an api key added to the header for each request, and the user token will only be needed for downloads. (but careful there, now you'll need to prefix it with "Bearer")

I also replaced the /find and /search endpoints, to have /features and /subtitles instead, but working pretty much the same.

The api will be production ready in the days to come, normally the last thing you'll have to change will be the main api url.

I've also changed the documentation framework, to move to stoplight, hopefully it'll be more readable

https://opensubtitles.stoplight.io/docs ... n_api.json

Re: [OS] Brand new REST API for testing

Posted: Sun Dec 27, 2020 9:33 am
by joeyck
Hello! Nice work on the API

However I can't get it to work right now. I'm trying to search using the subtitles endpoint and I always get the following repsonse:

Code: Select all

{ "message": "Not enough parameters" }
Here's my request

Code: Select all

curl --location --request GET 'https://www.opensubtitles.com/api/v1/subtitles?languages=ca' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Api-Key: REDACTED' \ --header 'Cookie: osdb_locale=en; __cfduid=d011738bb5663588739407b26add4ba2c1609053117; languages=ca'

Re: [OS] Brand new REST API for testing

Posted: Mon Dec 28, 2020 7:13 am
by oss
hi

you dont need to send any cookies. Your request is not complete, you specify the language, but not the query or anything what should be searched.

Re: [OS] Brand new REST API for testing

Posted: Mon Dec 28, 2020 11:03 am
by os_dev
Hello! Nice work on the API

However I can't get it to work right now. I'm trying to search using the subtitles endpoint and I always get the following repsonse:

Code: Select all

{ "message": "Not enough parameters" }
Here's my request

Code: Select all

curl --location --request GET 'https://www.opensubtitles.com/api/v1/subtitles?languages=ca' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --header 'Api-Key: REDACTED' \ --header 'Cookie: osdb_locale=en; __cfduid=d011738bb5663588739407b26add4ba2c1609053117; languages=ca'

the issue here is that you just search with a language.... that's not enough parameters (you can't just list all subtitles per languages like this if it's what you were trying to achieve). you need to send together a query, or some id.

The cookies appearing in the response was an error, it'll be gone very soon.

Re: [OS] Brand new REST API for testing

Posted: Tue Dec 29, 2020 6:05 am
by joeyck

the issue here is that you just search with a language.... that's not enough parameters (you can't just list all subtitles per languages like this if it's what you were trying to achieve). you need to send together a query, or some id.

The cookies appearing in the response was an error, it'll be gone very soon.
I see! Thanks for the quick response.
In the previous beta version it was possible to call this endpoint to get the latest subtitles files uploaded in a specific language. But now it does not seem to work anymore.

Code: Select all

https://www.opensubtitles.com/api/v1/subtitles?languages=ca&order_by=upload_date
Do you think this could be re-implemented in the future? For me it's useful because there are not many uploads in my language so it's great to be able to get this without specifying a query.

Thank you very much.

Re: [OS] Brand new REST API for testing

Posted: Tue Dec 29, 2020 4:32 pm
by os_dev

Code: Select all

https://www.opensubtitles.com/api/v1/subtitles?languages=ca&order_by=upload_date
Do you think this could be re-implemented in the future? For me it's useful because there are not many uploads in my language so it's great to be able to get this without specifying a query.

Thank you very much.
Would take a bit of a different approach, making something like /discover/latest, taking a language parameter, that could do ?

While I'm there, how many results you want ? or last uploads in last 7 days ?

Re: [OS] Brand new REST API for testing

Posted: Wed Dec 30, 2020 2:44 am
by joeyck
Would take a bit of a different approach, making something like /discover/latest, taking a language parameter, that could do ?

While I'm there, how many results you want ? or last uploads in last 7 days ?
That would be great!! Maybe just returning the last 15-20 results is enough because sometimes there will be no uploads during the last 7 days :)

Re: [OS] Brand new REST API for testing

Posted: Mon Jan 11, 2021 6:57 pm
by os_dev
Would take a bit of a different approach, making something like /discover/latest, taking a language parameter, that could do ?

While I'm there, how many results you want ? or last uploads in last 7 days ?
That would be great!! Maybe just returning the last 15-20 results is enough because sometimes there will be no uploads during the last 7 days :)
So I created the desired endpoint:
https://opensubtitles.stoplight.io/docs ... latest/get

Will return 60 results in case someone wants to display longer lists

Re: [OS] Brand new REST API for testing

Posted: Sun Jan 31, 2021 5:04 pm
by pcwp
Would take a bit of a different approach, making something like /discover/latest, taking a language parameter, that could do ?

While I'm there, how many results you want ? or last uploads in last 7 days ?
That would be great!! Maybe just returning the last 15-20 results is enough because sometimes there will be no uploads during the last 7 days :)
So I created the desired endpoint:
https://opensubtitles.stoplight.io/docs ... latest/get

Will return 60 results in case someone wants to display longer lists
Working great for me.

Any chance of getting the parameter 'year' added as well? Then it would be possible to get the latest uploaded narrowed to just the latest titles, i.e. year=2021

Re: [OS] Brand new REST API for testing

Posted: Wed Feb 03, 2021 6:18 pm
by os_dev
Any chance of getting the parameter 'year' added as well? Then it would be possible to get the latest uploaded narrowed to just the latest titles, i.e. year=2021
hmm, a little tricky, it's all using global cached values for now.... but doable for sure, giving it a decent position in my to-do list.