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.
ElieM
Posts: 2
Joined: Wed Jun 08, 2022 11:10 pm

Re: [OS] Brand new REST API for testing

Sun Jun 12, 2022 3:32 am

@ElieM - thanks for info. Can you provide some examples please ?

1) on opensubtitles.com there are lets say 98% subtitles which are on opensubtitles.org (some not imported subtitles doesnt have proper format and so on)

2) so show where hash works on .org and doesnt work on .com - so we can peek into it (make sure subtitle is imported, it should be)

2 examples should be enough.
I went and did some extensive tests using RPC version and REST version.
More of less, their results were the same and I didn't get something substantial to submit here. So either my previous tests were wrong or something changed in between, either way I apologize for my previous statement.

Something I noticed though is that the subtitles I'm seeking actively exist on both websites.
It's 1 movie, and 6 episodes from the same series.

My code does a query based on the file name if the hash returns nothing (in the REST Version)

The movie didn't return results for a hash search, but worked for the query and returned subtitles.

2 of the 6 episodes returned results based on the hash, and 4 didn't return anything based on the hash.
Only 1 of the 4 returned only 1 query result and it had nothing to do with the episode, just words matching closely, the remaining 3 returned no subtitles, although all 6 episodes had subtitles on both websites.

Have to mention that the RPC version is only doing hash searches for now, so I didn't see what it would return for a query search, but the hash results were similar to the REST version.

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

Re: [OS] Brand new REST API for testing

Sun Jun 12, 2022 3:41 pm

thanks for clarification, if there something to fix/make better, let us know.

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

Re: [OS] Brand new REST API for testing

Sat Aug 13, 2022 11:52 am

Where we at for the upload API on REST?

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

Re: [OS] Brand new REST API for testing

Sat Sep 03, 2022 10:27 am

working on it.

viktoriia.macdev
Posts: 4
Joined: Wed Oct 05, 2022 10:15 am

Re: [OS] Brand new REST API for testing

Wed Oct 05, 2022 10:35 am

Hello.

I am migrating my app to the new API and ran into a problem.
When the file name is in Cyrillic, the search by query returns zero or much less results compared to XMLRPC API.

Example: search for subtitles in English for the movie Жених напрокат (the file name is in Russian).
Request:

Code: Select all

curl --location --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?languages=en&query=%D0%B6%D0%B5%D0%BD%D0%B8%D1%85+%D0%BD%D0%B0%D0%BF%D1%80%D0%BE%D0%BA%D0%B0%D1%82' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json' --header 'Accept: */*'
Response:

Code: Select all

{"total_pages":0,"total_count":0,"per_page":60,"page":1,"data":[]}

XMLRPC API request:

Code: Select all

curl -L --data '<?xml version="1.0"?>'\ '<methodCall>'\ '<methodName>SearchSubtitles</methodName>'\ '<params>'\ '<param><value><string>TOKEN</string></value></param>'\ '<param>'\ '<value><array><data><value>'\ '<struct>'\ '<member><name>query</name><value><string>Жених напрокат</string></value></member>'\ '<member><name>sublanguageid</name><value><string>en,eng</string></value></member>'\ '</struct>'\ '</value></data></array></value>'\ '</param>'\ '</params>'\ '</methodCall>' 'http://api.opensubtitles.org/xml-rpc'
There are 37 results in the response.

Am I doing something wrong?

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

Re: [OS] Brand new REST API for testing

Thu Oct 06, 2022 10:04 am

Hello.

I am migrating my app to the new API and ran into a problem.
When the file name is in Cyrillic, the search by query returns zero or much less results compared to XMLRPC API.

Example: search for subtitles in English for the movie Жених напрокат (the file name is in Russian).
Request:

Code: Select all

curl --location --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?languages=en&query=%D0%B6%D0%B5%D0%BD%D0%B8%D1%85+%D0%BD%D0%B0%D0%BF%D1%80%D0%BE%D0%BA%D0%B0%D1%82' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json' --header 'Accept: */*'
Response:

Code: Select all

{"total_pages":0,"total_count":0,"per_page":60,"page":1,"data":[]}

XMLRPC API request:

Code: Select all

curl -L --data '<?xml version="1.0"?>'\ '<methodCall>'\ '<methodName>SearchSubtitles</methodName>'\ '<params>'\ '<param><value><string>TOKEN</string></value></param>'\ '<param>'\ '<value><array><data><value>'\ '<struct>'\ '<member><name>query</name><value><string>Жених напрокат</string></value></member>'\ '<member><name>sublanguageid</name><value><string>en,eng</string></value></member>'\ '</struct>'\ '</value></data></array></value>'\ '</param>'\ '</params>'\ '</methodCall>' 'http://api.opensubtitles.org/xml-rpc'
There are 37 results in the response.

Am I doing something wrong?

thanks for pointing this out, the search was actually just going to subtitle file names, and not "title aka". It's gonna be fixed within a few days, the feature is added, but I need a bit of time to test everything.

note that there are 17 subtitles for this movie on this language in our database, the old api was showing over 50% of wrong results for this query, and the new one (afte the fix) will just return the 17 proper results.

Thank you so much for your feedback and comment, this is how we can really improve our services.

viktoriia.macdev
Posts: 4
Joined: Wed Oct 05, 2022 10:15 am

Re: [OS] Brand new REST API for testing

Thu Oct 06, 2022 12:07 pm

Hello.

I am migrating my app to the new API and ran into a problem.
When the file name is in Cyrillic, the search by query returns zero or much less results compared to XMLRPC API.

Example: search for subtitles in English for the movie Жених напрокат (the file name is in Russian).
Request:

Code: Select all

curl --location --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?languages=en&query=%D0%B6%D0%B5%D0%BD%D0%B8%D1%85+%D0%BD%D0%B0%D0%BF%D1%80%D0%BE%D0%BA%D0%B0%D1%82' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json' --header 'Accept: */*'
Response:

Code: Select all

{"total_pages":0,"total_count":0,"per_page":60,"page":1,"data":[]}

XMLRPC API request:

Code: Select all

curl -L --data '<?xml version="1.0"?>'\ '<methodCall>'\ '<methodName>SearchSubtitles</methodName>'\ '<params>'\ '<param><value><string>TOKEN</string></value></param>'\ '<param>'\ '<value><array><data><value>'\ '<struct>'\ '<member><name>query</name><value><string>Жених напрокат</string></value></member>'\ '<member><name>sublanguageid</name><value><string>en,eng</string></value></member>'\ '</struct>'\ '</value></data></array></value>'\ '</param>'\ '</params>'\ '</methodCall>' 'http://api.opensubtitles.org/xml-rpc'
There are 37 results in the response.

Am I doing something wrong?

thanks for pointing this out, the search was actually just going to subtitle file names, and not "title aka". It's gonna be fixed within a few days, the feature is added, but I need a bit of time to test everything.

note that there are 17 subtitles for this movie on this language in our database, the old api was showing over 50% of wrong results for this query, and the new one (afte the fix) will just return the 17 proper results.

Thank you so much for your feedback and comment, this is how we can really improve our services.
Thank you very much for your quick reply. I'm looking forward to the fix.

Meanwhile, I have several questions about search results.
The results are ordered by download_count by default, aren't they?
What is the difference between download_count and new_download_count? Total downloads from opensubtitles.org and opensubtitles.com respectively?

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

Re: [OS] Brand new REST API for testing

Thu Oct 06, 2022 2:17 pm


Thank you very much for your quick reply. I'm looking forward to the fix.

Meanwhile, I have several questions about search results.
The results are ordered by download_count by default, aren't they?
What is the difference between download_count and new_download_count? Total downloads from opensubtitles.org and opensubtitles.com respectively?
Yes, they are ordered by download count by default, and you can set an "order_by" parameter to change that.

and yes, you got it, download_count is transferred from opensubtitles.org, and new_download_count is from .com, hopefully will be merged someday (please don't ask when)

viktoriia.macdev
Posts: 4
Joined: Wed Oct 05, 2022 10:15 am

Re: [OS] Brand new REST API for testing

Thu Nov 10, 2022 1:16 pm

Hello.
I have one more question.

Search for English subtitles for the movie with filename s01e01 - the pilot and moviehash 1b0ad2f7cb68ce4e.

The XMLRPC API request returns 500 results (1 result is matched by moviehash).

Code: Select all

curl -L --data '<?xml version="1.0"?><methodCall><methodName>SearchSubtitles</methodName><params><param><value><string>TOKEN</string></value></param><param><value><array><data><value><struct><member><name>sublanguageid</name><value><string>en,eng</string></value></member><member><name>moviebytesize</name><value><double>313641311</double></value></member><member><name>moviehash</name><value><string>1b0ad2f7cb68ce4e</string></value></member></struct></value><value><struct><member><name>query</name><value><string>s01e01 - the pilot</string></value></member><member><name>sublanguageid</name><value><string>en,eng</string></value></member></struct></value></data></array></value></param></params></methodCall>' http://api.opensubtitles.org/xml-rpc

The REST API request returns 60 results (no one is matched by moviehash).

Code: Select all

curl -L --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?languages=en&moviehash=1b0ad2f7cb68ce4e&query=s01e01+-+the+pilot' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json' --header 'Accept: */*'
The REST API request without query returns the desired subtitles matched by moviehash:

Code: Select all

curl -L --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?languages=en&moviehash=1b0ad2f7cb68ce4e' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json' --header 'Accept: */*'
The question is, why doesn't the REST API request with the query specified return subtitles matched by moviehash?

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

Re: [OS] Brand new REST API for testing

Fri Nov 11, 2022 12:06 am


The question is, why doesn't the REST API request with the query specified return subtitles matched by moviehash?
Well the title of this specific episode is "The One Where Monica Gets A Roommate" on IMDB... I see it's "the pilot" on tmdb, but by design we keep the IMDB value in English...

always a mess to deal with episodes, works best if possible to get the parent id and send the episode & season numbers.

then for the behaviour, for now if you send a query and a movie hash, the search will be done primarily on the query, then filtered on the moviehash to find the matching.

meaning that if a subtitle matches the moviehash, but not the query, it won't show up.

it's ideally designed for a system where the files are indexed somehow, and you got the related ID's available (imdb, tmdb....)

if you are just discovering files, there's too much randomness with file names that matches the movie, release name or just "cd-1" or stuff like that, better just to send the moviehash alone, and you'll get all matching files.

we couldn't make a magic solution that deals with all the attributes to figure out the most relevant, developers need to find the approach that works best for them.

and if more features are needed, if they can be clearly described we'll do our best to implement them, searching by moviehash only for example was a feature request.

viktoriia.macdev
Posts: 4
Joined: Wed Oct 05, 2022 10:15 am

Re: [OS] Brand new REST API for testing

Fri Nov 11, 2022 9:39 am

OK. Thank you for the clarification!

viktoriia.macdev
Posts: 4
Joined: Wed Oct 05, 2022 10:15 am

Re: [OS] Brand new REST API for testing

Fri Nov 18, 2022 1:07 pm

I have noticed that the number of search results returned per page can be changed by adding a query parameter named per_page. But this parameter is not documented. Is it safe to specify it?
Request:

Code: Select all

curl -L --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?per_page=300&query=shrek' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json'
Response:
{"total_pages":6,"total_count":1648,"per_page":300,"page":1,"data":[...]}
Last edited by viktoriia.macdev on Fri Nov 18, 2022 1:17 pm, edited 1 time in total.

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

Re: [OS] Brand new REST API for testing

Mon Nov 28, 2022 8:37 pm

Hi,

In the following query, file_name of the second item (id: 4373128) is null, but when I send a request to the /download endpoint, it will return the file_name as expected. Could this be a bug?

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?languages=en&moviehash=8666e953d90a73cc&query=amelie.2001.1080p.bluray.6ch.x265.hevc.mkv
As you can see, file_name is null here:

Code: Select all

{ "id": "4373128", "type": "subtitle", "attributes": { "subtitle_id": "4373128", "language": "en", "download_count": 65456, "new_download_count": 491, "hearing_impaired": false, "hd": true, "fps": 25.0, "votes": 1, "ratings": 10.0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2010-12-15T00:25:56Z", "ai_translated": false, "machine_translated": false, "release": "Amelie.2001.720p.BluRay.x264-HD", "comments": "", "legacy_subtitle_id": 4008377, "uploader": { "uploader_id": 3282, "name": "os-auto", "rank": "Application Developers" }, "feature_details": { "feature_id": 646324, "feature_type": "Movie", "year": 2001, "title": "Amélie", "movie_name": "2001 - Amélie", "imdb_id": 211915, "tmdb_id": 194 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/4008377", "related_links": { "label": "All subtitles for Amélie", "url": "https://www.opensubtitles.com/en/movies/2001-amelie", "img_url": "https://s9.osdb.link/features/4/2/3/646324.jpg" }, "files": [ { "file_id": 4472858, "cd_number": 1, "file_name": null } ], "moviehash_match": false } }

but the download endpoint returns the file_name correctly:

Code: Select all

{ "link": "<REMOVED>/subfile/Amelie.2001.720p.BluRay.srt", "file_name": "Amelie.2001.720p.BluRay.srt", "requests": 1, "remaining": 4, "message": "Your quota will be renewed in 23 hours and 59 minutes (2022-11-29 18:24:25 UTC) ", "reset_time": "23 hours and 59 minutes", "reset_time_utc": "2022-11-29T18:24:25.404Z" }

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

Re: [OS] Brand new REST API for testing

Tue Nov 29, 2022 7:17 pm

Hi,

In the following query, file_name of the second item (id: 4373128) is null, but when I send a request to the /download endpoint, it will return the file_name as expected. Could this be a bug?

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?languages=en&moviehash=8666e953d90a73cc&query=amelie.2001.1080p.bluray.6ch.x265.hevc.mkv
As you can see, file_name is null here:

Code: Select all

{ "id": "4373128", "type": "subtitle", "attributes": { "subtitle_id": "4373128", "language": "en", "download_count": 65456, "new_download_count": 491, "hearing_impaired": false, "hd": true, "fps": 25.0, "votes": 1, "ratings": 10.0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2010-12-15T00:25:56Z", "ai_translated": false, "machine_translated": false, "release": "Amelie.2001.720p.BluRay.x264-HD", "comments": "", "legacy_subtitle_id": 4008377, "uploader": { "uploader_id": 3282, "name": "os-auto", "rank": "Application Developers" }, "feature_details": { "feature_id": 646324, "feature_type": "Movie", "year": 2001, "title": "Amélie", "movie_name": "2001 - Amélie", "imdb_id": 211915, "tmdb_id": 194 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/4008377", "related_links": { "label": "All subtitles for Amélie", "url": "https://www.opensubtitles.com/en/movies/2001-amelie", "img_url": "https://s9.osdb.link/features/4/2/3/646324.jpg" }, "files": [ { "file_id": 4472858, "cd_number": 1, "file_name": null } ], "moviehash_match": false } }

but the download endpoint returns the file_name correctly:

Code: Select all

{ "link": "<REMOVED>/subfile/Amelie.2001.720p.BluRay.srt", "file_name": "Amelie.2001.720p.BluRay.srt", "requests": 1, "remaining": 4, "message": "Your quota will be renewed in 23 hours and 59 minutes (2022-11-29 18:24:25 UTC) ", "reset_time": "23 hours and 59 minutes", "reset_time_utc": "2022-11-29T18:24:25.404Z" }
hi,

yes, there was a bug in the /subtitles endpoint !

thanks for pointing it out, will be fixed soon

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

Re: [OS] Brand new REST API for testing

Tue Nov 29, 2022 7:19 pm

I have noticed that the number of search results returned per page can be changed by adding a query parameter named per_page. But this parameter is not documented. Is it safe to specify it?
Request:

Code: Select all

curl -L --request GET --url 'https://api.opensubtitles.com/api/v1/subtitles?per_page=300&query=shrek' --header 'Api-Key: YOUR_API_KEY' --header 'Content-Type: application/json'
Response:
{"total_pages":6,"total_count":1648,"per_page":300,"page":1,"data":[...]}
yeah it's available, and working... we didn't document it to optimise the caching, but you can use it now that you found it ;)

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 2 guests