Page 1 of 1

API Search: Missing/Incorrect results?

Posted: Mon Nov 13, 2023 6:34 pm
by GameGod_75
Hi,

The REST API is not returning the results as expected.

This returns no results:

Code: Select all

GET /api/v1/subtitles?episode_number=8&imdb_id=27089983&languages=en&season_number=1
, even though it has two subtitles that should match: https://www.opensubtitles.org/en/search ... d-27348179

Is this a bug or am I doing something wrong?

Thanks.

Re: API Search: Missing results?

Posted: Sun Nov 19, 2023 2:12 am
by burekas
How the "headers" is look like?
Do you use the Api-Key?

Re: API Search: Missing/Incorrect results?

Posted: Tue Nov 21, 2023 8:44 pm
by GameGod_75
Looks like something was fixed, because when I tried it just now, it's returning two results. However, the type of the returned result is wrong. The result for each item claims that it's a "movie" but it should be "episode" in data["attributes"]["feature_details"]["feature_type"]. Pasting the result I'm seeing below:

Code: Select all

{ "total_pages":1, "total_count":2, "per_page":60, "page":1, "data":[ { "id":"7421401", "type":"subtitle", "attributes":{ "subtitle_id":"7421401", "language":"en", "download_count":5, "new_download_count":6, "hearing_impaired":false, "hd":true, "fps":25.0, "votes":0, "ratings":0.0, "from_trusted":false, "foreign_parts_only":false, "upload_date":"2023-10-17T02:35:17Z", "ai_translated":false, "machine_translated":false, "release":"mother.and.son.2023.s01e07.1080p.hdtv.h264-cbfm[eztv.re]", "comments":"", "legacy_subtitle_id":9751813, "legacy_uploader_id":5892583, "uploader":{ "uploader_id":81402, "name":"bakugan52", "rank":"Platinum Member" }, "feature_details":{ "feature_id":1505663, "feature_type":"Movie", "year":2023, "title":"Episode 7", "movie_name":"2023 - \"Mother and Son\" Roadtrip", "imdb_id":27348173, "tmdb_id":4706179 }, "url":"https://www.opensubtitles.com/en/subtitles/legacy/9751813", "related_links":[ { "label":"All subtitles for episode 7", "url":"https://www.opensubtitles.com/en/movies/7-episode-7-1268726", "img_url":"https://s9.opensubtitles.com/features/3/6/6/1505663.jpg" } ], "files":[ { "file_id":8353892, "cd_number":1, "file_name":"mother.and.son.2023.s01e07.1080p.hdtv.h264-cbfm[eztv.re]" } ] } }, { "id":"7421400", "type":"subtitle", "attributes":{ "subtitle_id":"7421400", "language":"en", "download_count":3, "new_download_count":0, "hearing_impaired":true, "hd":true, "fps":25.0, "votes":0, "ratings":0.0, "from_trusted":false, "foreign_parts_only":false, "upload_date":"2023-10-17T02:34:31Z", "ai_translated":false, "machine_translated":false, "release":"mother.and.son.2023.s01e07.1080p.hdtv.h264-cbfm[eztv.re]", "comments":"", "legacy_subtitle_id":9751811, "legacy_uploader_id":5892583, "uploader":{ "uploader_id":81402, "name":"bakugan52", "rank":"Platinum Member" }, "feature_details":{ "feature_id":1505663, "feature_type":"Movie", "year":2023, "title":"Episode 7", "movie_name":"2023 - \"Mother and Son\" Roadtrip", "imdb_id":27348173, "tmdb_id":4706179 }, "url":"https://www.opensubtitles.com/en/subtitles/legacy/9751811", "related_links":[ { "label":"All subtitles for episode 7", "url":"https://www.opensubtitles.com/en/movies/7-episode-7-1268726", "img_url":"https://s9.opensubtitles.com/features/3/6/6/1505663.jpg" } ], "files":[ { "file_id":8353891, "cd_number":1, "file_name":"mother.and.son.2023.s01e07.1080p.hdtv.h264-cbfm[eztv.re]" } ] } } ] }

Re: API Search: Missing/Incorrect results?

Posted: Wed Nov 22, 2023 3:43 pm
by os_dev
Looks like something was fixed, because when I tried it just now, it's returning two results. However, the type of the returned result is wrong. The result for each item claims that it's a "movie" but it should be "episode" in data["attributes"]["feature_details"]["feature_type"]. Pasting the result I'm seeing below:
so, yes, there are a lot of cleaning going on these days to fix similar cases of wrongly allocated episodes.

but you are getting random results here actually because of an error in our code that returns results when it shoulnt (that will be fixed shorty). because the request is wrong:

GET /api/v1/subtitles?episode_number=8&imdb_id=27089983&languages=en&season_number=1

here, the imdbid 27089983 is for the tv serie
https://www.imdb.com/title/tt27089983

so if you want to call a season and episode number, you need to send it as parent_imdb_id
GET /api/v1/subtitles?episode_number=8&parent_imdb_id=27089983&languages=en&season_number=1

this way you'll get the correct results.

to get the subtitles for a specific episode by imdbid, you need to send the episode imdbid, and no episode_number or season_number
GET /api/v1/subtitles?imdb_id=27089983&languages=en

Re: API Search: Missing/Incorrect results?

Posted: Wed Nov 22, 2023 7:24 pm
by burekas
For me using "parent_imdb_id" or "imdb_id" for episode gives the same correct results, there is no difference.

Re: API Search: Missing/Incorrect results?

Posted: Thu Nov 23, 2023 6:16 am
by GameGod_75
Looks like something was fixed, because when I tried it just now, it's returning two results. However, the type of the returned result is wrong. The result for each item claims that it's a "movie" but it should be "episode" in data["attributes"]["feature_details"]["feature_type"]. Pasting the result I'm seeing below:
so, yes, there are a lot of cleaning going on these days to fix similar cases of wrongly allocated episodes.

but you are getting random results here actually because of an error in our code that returns results when it shoulnt (that will be fixed shorty). because the request is wrong:

GET /api/v1/subtitles?episode_number=8&imdb_id=27089983&languages=en&season_number=1

here, the imdbid 27089983 is for the tv serie
https://www.imdb.com/title/tt27089983

so if you want to call a season and episode number, you need to send it as parent_imdb_id
GET /api/v1/subtitles?episode_number=8&parent_imdb_id=27089983&languages=en&season_number=1

this way you'll get the correct results.

to get the subtitles for a specific episode by imdbid, you need to send the episode imdbid, and no episode_number or season_number
GET /api/v1/subtitles?imdb_id=27089983&languages=en
I updated the url to this, per your recommendation:

Code: Select all

https://api.opensubtitles.com/api/v1/subtitles?languages=en&parent_imdb_id=27089983&season_number=1&episode_number=8
The first result's type is correct ('Episode') but the second one still returns ('Movie') which is incorrect.

These are the results I see:

Code: Select all

{ "total_pages": 1, "total_count": 2, "per_page": 60, "page": 1, "data": [ { "id": "7421396", "type": "subtitle", "attributes": { "subtitle_id": "7421396", "language": "en", "download_count": 22, "new_download_count": 6, "hearing_impaired": false, "hd": true, "fps": 25, "votes": 0, "ratings": 0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2023-10-17T02:35:36Z", "ai_translated": false, "machine_translated": false, "release": "mother.and.son.2023.s01e08.1080p.hdtv.h264-cbfm[eztv.re]", "comments": "", "legacy_subtitle_id": 9751814, "legacy_uploader_id": 5892583, "uploader": { "uploader_id": 81402, "name": "bakugan52", "rank": "Platinum Member" }, "feature_details": { "feature_id": 1505661, "feature_type": "Episode", "year": null, "title": "Episode 8", "movie_name": "Mother and Son - S01E08 Episode 8", "imdb_id": 27348179, "tmdb_id": 4706180, "season_number": 1, "episode_number": 8, "parent_imdb_id": 27089983, "parent_title": "Mother and Son", "parent_tmdb_id": 233239, "parent_feature_id": 1509756 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/9751814", "related_links": [ { "label": "All subtitles for Tv Show Mother and Son", "url": "https://www.opensubtitles.com/en/features/redirect/1509756", "img_url": "https://s9.opensubtitles.com/features/1/6/6/1505661.jpg" }, { "label": "All subtitles for Episode episode 8", "url": "https://www.opensubtitles.com/en/features/redirect/1505661" } ], "files": [ { "file_id": 8353887, "cd_number": 1, "file_name": "mother.and.son.2023.s01e08.1080p.hdtv.h264-cbfm[eztv.re]" } ] } }, { "id": "7421395", "type": "subtitle", "attributes": { "subtitle_id": "7421395", "language": "en", "download_count": 3, "new_download_count": 0, "hearing_impaired": true, "hd": true, "fps": 25, "votes": 0, "ratings": 0, "from_trusted": false, "foreign_parts_only": false, "upload_date": "2023-10-17T02:34:52Z", "ai_translated": false, "machine_translated": false, "release": "mother.and.son.2023.s01e08.1080p.hdtv.h264-cbfm[eztv.re]", "comments": "", "legacy_subtitle_id": 9751812, "legacy_uploader_id": 5892583, "uploader": { "uploader_id": 81402, "name": "bakugan52", "rank": "Platinum Member" }, "feature_details": { "feature_id": 1505661, "feature_type": "Movie", "year": null, "title": "Episode 8", "movie_name": " - \"Mother and Son\" Bad Influence", "imdb_id": 27348179, "tmdb_id": 4706180 }, "url": "https://www.opensubtitles.com/en/subtitles/legacy/9751812", "related_links": [ { "label": "All subtitles for episode 8", "url": "https://www.opensubtitles.com/en/movies/8-episode-8-1268727", "img_url": "https://s9.opensubtitles.com/features/1/6/6/1505661.jpg" } ], "files": [ { "file_id": 8353888, "cd_number": 1, "file_name": "mother.and.son.2023.s01e08.1080p.hdtv.h264-cbfm[eztv.re]" } ] } } ] }