Page 1 of 1

restful api does not work any more

Posted: Sat Aug 06, 2022 2:09 pm
by redguardtoo
Hi,
My open source project https://github.com/redguardtoo/shenshou started using new restful api.

It worked at the beginning, but after a few day the api did not work.

Here is the debug log,

Code: Select all

Fetching subtitles of 1 video(s) ... shenshou-download-subtitle-internal called => The Mary Tyler Moore Show S01E01 Love is All Around.mkv shenshou-login-now called. shenshou-restful-call called => post-data={"username": "redguardtoo", "password": "mypassword"} cmd=curl --request POST --silent --insecure --url "https://api.opensubtitles.com/api/v1/login" -H "Api-Key: 9PEmFOnb2IzOHAbpbwRWcll01IsIjfFz" -H "Content-Type: application/json" --data '{"username": "redguardtoo", "password": "mypassword"}' cmd-output={"user":{"allowed_translations":1,"allowed_downloads":20,"level":"Sub leecher","user_id":335072,"ext_installed":false,"vip":false},"token":"{edited-oken}","status":200} user=((allowed_translations . 1) (allowed_downloads . 20) (level . Sub leecher) (user_id . 335072) (ext_installed . :json-false) (vip . :json-false)) token={edited-token} status=200 User redguardtoo logged into ’https://opensubtitles.com’: user_id=335072 allowed_downloads(daily)=20 level=Sub leecher shenshou-params-from-videos => rlt=languages=en&query=The%20Mary%20Tyler%20Moore%20Show&episode_number=01&season_number=01 shenshou-restful-call called => post-data=nil cmd=curl --request GET --silent --insecure --url "https://api.opensubtitles.com/api/v1/subtitles?languages=en&query=The%20Mary%20Tyler%20Moore%20Show&episode_number=01&season_number=01" -H "Api-Key: {edited-api-key"" -H "Authorization: Bearer {edited-token}" -H "Content-Type: application/json" cmd-output= setq: End of file while parsing JSON user-error: Previous command was not an evil-paste: winum-select-window-2 M-[ 1 1 1 is undefined ; 9 is undefined command-execute: Buffer is read-only: #<buffer *Messages*>
As you can see the login succeeded and I got the token,

But the GET api call returned nothing. Here is the full curl cli

Code: Select all

curl --request GET --silent --insecure --url "https://api.opensubtitles.com/api/v1/subtitles?languages=en&query=The%20Mary%20Tyler%20Moore%20Show&episode_number=01&season_number=01" -H "Api-Key: {edited-api-key}" -H "Authorization: Bearer {edited-token}" -H "Content-Type: application/json"
Edited tokens and api keys by OSS

Re: restful api does not work any more

Posted: Mon Aug 08, 2022 9:02 am
by oss
I am not sure how I can mark it better, but well, I will try.

You forget -L (or --location) (to follow redirects) parameter.

Please read this: https://opensubtitles.stoplight.io/docs ... -practices