My code:
Code: Select all
from xmlrpc.client import ServerProxy
from pprint import pprint
import json
imbd='tt0499549'#-->Avatar
#'tt1723811'-->Shame 2011
server = ServerProxy("http://api.opensubtitles.org/xml-rpc")
token = server.LogIn('username', 'password', 'eng', 'xname ')['token']
response = server.SearchSubtitles(token, [{'sublanguageid': 'eng', 'query':imbd }])
pprint(response)
When I try some movie id such as imbd='tt0499549'>Avatar
respond = {'data': [], 'seconds': 0.004, 'status': '200 OK'}
When I try
imbd=tt1723811'>Shame 2011
All good but I see a lot of file information I don't need. I need just one English subtitle file. I want to create a learning application. But still ok for me like that.
-----------------------------------------------------------
One guy response to me in 'StackOverflow. He said me to use the new app. I tried today
https://stackoverflow.com/questions/667 ... titles-api
Code: Select all
headers = {
'Api-Key': api_key,
}
params = (
('imdb_id', movie_id),
)
response = requests.get('https://www.opensubtitles.com/api/v1/subtitles', headers=headers, params=params)
print(response)
#--------------------------------------------------
headers = {
'Api-Key': api_key,
'Authorization': auth,
'Content-Type': 'application/json',
}
data = '{"file_id":5274788}'
response = requests.post('https://www.opensubtitles.com/api/v1/download', headers=headers, data=data)
print(response)
<Response [200]>
<Response [503]>
I have an API key, API name. I don't know what I'm gonna write for Authorization. I tried all combinations.
How I can reach the subtitle information?