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.
abdalaoe
Posts: 2
Joined: Sun Aug 30, 2020 1:19 am

Re: [OS] Brand new REST API for testing

Sat Sep 05, 2020 8:14 pm

Hi there!
I made a golang library to access this new API rest here :https://github.com/TheForgotten69/go-opensubtitles

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 Sep 09, 2020 11:30 am

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

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

Re: [OS] Brand new REST API for testing

Fri Oct 02, 2020 5:38 pm

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

Redbirdie
Posts: 6
Joined: Fri Oct 09, 2020 4:25 pm

Re: [OS] Brand new REST API for testing

Fri Oct 09, 2020 4:35 pm

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

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

Re: [OS] Brand new REST API for testing

Sun Oct 11, 2020 12:45 am

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.

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

Re: [OS] Brand new REST API for testing

Tue Nov 10, 2020 4:39 pm

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

joeyck
Posts: 3
Joined: Sun Dec 27, 2020 9:30 am

Re: [OS] Brand new REST API for testing

Sun Dec 27, 2020 9:33 am

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'

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

Mon Dec 28, 2020 7:13 am

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.

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

Re: [OS] Brand new REST API for testing

Mon Dec 28, 2020 11:03 am

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.

joeyck
Posts: 3
Joined: Sun Dec 27, 2020 9:30 am

Re: [OS] Brand new REST API for testing

Tue Dec 29, 2020 6:05 am


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.

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

Re: [OS] Brand new REST API for testing

Tue Dec 29, 2020 4:32 pm

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 ?

joeyck
Posts: 3
Joined: Sun Dec 27, 2020 9:30 am

Re: [OS] Brand new REST API for testing

Wed Dec 30, 2020 2:44 am

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 :)

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

Re: [OS] Brand new REST API for testing

Mon Jan 11, 2021 6:57 pm

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

pcwp
Posts: 1
Joined: Sun Jan 31, 2021 5:00 pm

Re: [OS] Brand new REST API for testing

Sun Jan 31, 2021 5:04 pm

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

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

Re: [OS] Brand new REST API for testing

Wed Feb 03, 2021 6:18 pm

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.

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 27 guests