当我使用浏览器访问YTS' REST API's query page时,我会看到JSON答复中的所有字段(movie_count,limit,page_number和movie),但是当我使用python脚本执行相同操作时,“ movies”字段不见了。我不明白为什么。身份验证不是问题,因为使用浏览器访问链接时我没有登录。
这是脚本:
import json
import requests
def search(term):
options = {
'limit' : 30,
'page' : 1,
'quality' : "All",
'query_term' : term,
'genre' : "All",
'sort_by' : "seeds"
}
r = requests.get("https://yts.am/api/v2/list_movies.json", params=options)
print(r.text)
def main():
search("york")
if __name__ == '__main__':
main()
这是我得到的答复:
{"status":"ok","status_message":"Query was successful","data":{"movie_count":11,"limit":30,"page_number":1},"@meta":{"server_time":1530026473,"server_timezone":"CET","api_version":2,"execution_time":"0.03 ms"}}