票房排名数据
请求Header:
名称 | 值 | |
---|---|---|
Content-Type | application/x-www-form-urlencoded |
请求参数说明:
名称 | 必填 | 类型 | 说明 | |
---|---|---|---|---|
key | 是 | string | 接口请求key,在个人中心->数据中心->我的API进行查看 |
请求代码示例:
curl -k -i "http://apis.juhe.cn/fapig/boxoffice/query?key=key"
<?php
/**
* 1942-票房排名数据 - 代码参考(根据实际业务情况修改)
*/
// 基本参数配置
$apiUrl = "http://apis.juhe.cn/fapig/boxoffice/query"; // 接口请求URL
$method = "GET"; // 接口请求方式
$headers = ["Content-Type: application/x-www-form-urlencoded"]; // 接口请求header
$apiKey = "您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
$requestParams = [
'key' => $apiKey,
];
$requestParamsStr = http_build_query($requestParams);
// 发起接口网络请求
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $apiUrl . '?' . $requestParamsStr);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if (1 == strpos("$" . $apiUrl, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$response = curl_exec($curl);
$httpInfo = curl_getinfo($curl);
curl_close($curl);
// 解析响应结果
$responseResult = json_decode($response, true);
if ($responseResult) {
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
var_dump($responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
// var_dump($httpInfo);
var_dump("请求异常");
}
import requests
# 1942-票房排名数据 - 代码参考(根据实际业务情况修改)
# 基本参数配置
apiUrl = 'http://apis.juhe.cn/fapig/boxoffice/query' # 接口请求URL
apiKey = '您申请的调用APIkey' # 在个人中心->我的数据,接口名称上方查看
# 接口请求入参配置
requestParams = {
'key': apiKey,
}
# 发起接口网络请求
response = requests.get(apiUrl, params=requestParams)
# 解析响应结果
if response.status_code == 200:
responseResult = response.json()
# 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
print(responseResult)
else:
# 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
print('请求异常')
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
)
func main() {
// 基本参数配置
apiUrl := "http://apis.juhe.cn/fapig/boxoffice/query"
apiKey := "您申请的调用APIkey"
// 接口请求入参配置
requestParams := url.Values{}
requestParams.Set("key", apiKey)
// 发起接口网络请求
resp, err := http.Get(apiUrl + "?" + requestParams.Encode())
if err != nil {
fmt.Println("网络请求异常:", err)
return
}
defer resp.Body.Close()
var responseResult map[string]interface{}
err = json.NewDecoder(resp.Body).Decode(&responseResult)
if err != nil {
fmt.Println("解析响应结果异常:", err)
return
}
fmt.Println(responseResult)
}
using System;
using System.Net;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace Common_API_Test.Test_Demo
{
class Csharp_get
{
static void Main(string[] args)
{
string url = "http://apis.juhe.cn/fapig/boxoffice/query";
string apiKey = "您申请的调用APIkey";
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("key", apiKey);
using (WebClient client = new WebClient())
{
string fullUrl = url + "?" + string.Join("&", data.Select(x => x.Key + "=" + x.Value));
try
{
string responseContent = client.DownloadString(fullUrl);
dynamic responseData = JsonConvert.DeserializeObject(responseContent);
if (responseData != null)
{
Console.WriteLine("Return Code: " + responseData["error_code"]);
Console.WriteLine("Return Message: " + responseData["reason"]);
}
else
{
Console.WriteLine("json解析异常!");
}
}
catch (Exception)
{
Console.WriteLine("请检查其它错误");
}
}
}
}
}
const axios = require('axios'); // npm install axios
// 基本参数配置
const apiUrl = 'http://apis.juhe.cn/fapig/boxoffice/query'; // 接口请求URL
const apiKey = '您申请的调用APIkey'; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
const requestParams = {
key: apiKey,
};
// 发起接口网络请求
axios.get(apiUrl, {params: requestParams})
.then(response => {
// 解析响应结果
if (response.status === 200) {
const responseResult = response.data;
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
console.log(responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
console.log('请求异常');
}
})
.catch(error => {
// 网络请求失败,可以根据实际情况进行处理
console.log('网络请求失败:', error);
});
package cn.juhe.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
public class JavaGet {
public static void main(String[] args) throws Exception {
String apiKey = "你申请的key";
String apiUrl = "http://apis.juhe.cn/fapig/boxoffice/query";
HashMap<String, String> map = new HashMap<>();
map.put("key", apiKey);
URL url = new URL(String.format("%s?%s", apiUrl, params(map)));
BufferedReader in = new BufferedReader(new InputStreamReader((url.openConnection()).getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response);
}
public static String params(Map<String, String> map) {
return map.entrySet().stream()
.map(entry -> {
try {
return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
} catch (Exception e) {
e.printStackTrace();
return entry.getKey() + "=" + entry.getValue();
}
})
.collect(Collectors.joining("&"));
}
}
// 基本参数配置
NSString *apiUrl = @"http://apis.juhe.cn/fapig/boxoffice/query"; // 接口请求URL
NSString *apiKey = @"您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
NSDictionary *requestParams = @{
@"key": apiKey,
};
// 发起接口网络请求
NSURLComponents *components = [NSURLComponents componentsWithString:apiUrl];
NSMutableArray *queryItems = [NSMutableArray array];
[requestParams enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) {
[queryItems addObject:[NSURLQueryItem queryItemWithName:key value:value]];
}];
components.queryItems = queryItems;
NSURL *url = components.URL;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
// 网络请求异常处理
NSLog(@"请求异常");
} else {
NSError *jsonError;
NSDictionary *responseResult = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (!jsonError) {
// 网络请求成功处理
// NSLog(@"%@", [responseResult objectForKey:@"error_code"]);
NSLog(@"%@", responseResult);
} else {
// 解析结果异常处理
NSLog(@"解析结果异常");
}
}
}];
[task resume];
返回参数说明:
名称 | 类型 | 说明 | |
---|---|---|---|
error_code | int | 返回码 | |
reason | string | 返回说明 | |
result | object | 返回结果集 | |
businessDay | string | 数据日期,格式:YYYY-MM-DD | |
dayBoxoffice | object | 当日票房汇总信息 | |
top10Films | array | TOP10电影列表 | |
top10CinemaChains | array | TOP10院线列表 | |
top10Citys | array | TOP10城市列表 | |
top10Cinemas | array | TOP10影院列表 | |
dayBoxoffice | |||
totalSession | int | 总场次 | |
totalAudience | int | 总观影人次 | |
totalBoxoffice | double | 总票房(万元) | |
cinemaCount | int | 影院数量 | |
businessDay | string | 数据日期 | |
top10Films | |||
rank | int | 排名 | |
filmName | string | 影片名称 | |
daySales | string | 当日票房(万元) | |
daySession | int | 当日场次 | |
dayAudience | int | 当日观影人次 | |
filmTotalSales | double | 累计票房(万元) | |
totalSales | double | 总票房(万元),可能为null | |
top10CinemaChains | |||
rank | int | 排名 | |
cinemaChainName | string | 院线名称 | |
totalSales | double | 票房(万元) | |
daySession | int | 场次 | |
dayAudience | int | 观影人次 | |
top10Citys | |||
rank | int | 排名 | |
cityName | string | 城市名称 | |
totalSales | double | 票房(万元) | |
daySession | int | 场次 | |
dayAudience | int | 观影人次 | |
top10Cinemas | |||
rank | int | 排名 | |
cinemaName | string | 影院名称 | |
totalSales | double | 票房(万元) | |
daySession | int | 场次 | |
dayAudience | int | 观影人次 |
JSON返回示例:JSON在线格式化工具 >
{
"reason": "success",
"result": {
"businessDay": "2025-02-07",
"dayBoxoffice": {
"totalSession": 397085,
"totalAudience": 14400448,
"totalBoxoffice": 68166.58,
"cinemaCount": 12537,
"businessDay": "2025-02-07"
},
"top10Films": [
{
"totalSales": null,
"daySession": 223209,
"dayAudience": 11386705,
"rank": 1,
"filmName": "哪吒之魔童闹海",
"daySales": "54110.94",
"filmTotalSales": 710595.26
},
{
"totalSales": null,
"daySession": 85167,
"dayAudience": 1844452,
"rank": 2,
"filmName": "唐探1900",
"daySales": "8618.23",
"filmTotalSales": 265806.09
},
{
"totalSales": null,
"daySession": 30618,
"dayAudience": 475806,
"rank": 3,
"filmName": "熊出没·重启未来",
"daySales": "2125.93",
"filmTotalSales": 60279.17
},
{
"totalSales": null,
"daySession": 27385,
"dayAudience": 356063,
"rank": 4,
"filmName": "封神第二部:战火西岐",
"daySales": "1765.63",
"filmTotalSales": 107540.47
},
{
"totalSales": null,
"daySession": 18369,
"dayAudience": 219295,
"rank": 5,
"filmName": "蛟龙行动",
"daySales": "1002.75",
"filmTotalSales": 33414.05
},
{
"totalSales": null,
"daySession": 11110,
"dayAudience": 107535,
"rank": 6,
"filmName": "射雕英雄传:侠之大者",
"daySales": "500.12",
"filmTotalSales": 61943.62
},
{
"totalSales": null,
"daySession": 383,
"dayAudience": 2395,
"rank": 7,
"filmName": "误杀3",
"daySales": "10.26",
"filmTotalSales": 93087.19
},
{
"totalSales": null,
"daySession": 28,
"dayAudience": 1135,
"rank": 8,
"filmName": "灶王传",
"daySales": "5.39",
"filmTotalSales": 179.43
},
{
"totalSales": null,
"daySession": 5,
"dayAudience": 966,
"rank": 9,
"filmName": "地球脉动:极境生存",
"daySales": "3.86",
"filmTotalSales": 505.84
},
{
"totalSales": null,
"daySession": 72,
"dayAudience": 810,
"rank": 10,
"filmName": "雄狮少年2",
"daySales": "3.28",
"filmTotalSales": 8082.21
}
],
"top10CinemaChains": [
{
"totalSales": 10358.86,
"daySession": 44281,
"dayAudience": 1930096,
"rank": 1,
"cinemaChainName": "珠海横琴万达电影院线有限公司"
},
{
"totalSales": 7180.57,
"daySession": 43692,
"dayAudience": 1549443,
"rank": 2,
"cinemaChainName": "中影电影院线有限公司"
},
{
"totalSales": 5826.72,
"daySession": 32830,
"dayAudience": 1269627,
"rank": 3,
"cinemaChainName": "深圳市中影南方电影新干线有限公司"
},
{
"totalSales": 4516.31,
"daySession": 23196,
"dayAudience": 895821,
"rank": 4,
"cinemaChainName": "上海联和电影院线公司"
},
{
"totalSales": 3576.87,
"daySession": 22675,
"dayAudience": 787517,
"rank": 5,
"cinemaChainName": "广东大地电影院线股份有限公司"
},
{
"totalSales": 3469.79,
"daySession": 17873,
"dayAudience": 726456,
"rank": 6,
"cinemaChainName": "横店影视股份有限公司"
},
{
"totalSales": 2681.52,
"daySession": 17908,
"dayAudience": 586153,
"rank": 7,
"cinemaChainName": "江苏幸福蓝海院线有限责任公司"
},
{
"totalSales": 2625.48,
"daySession": 17140,
"dayAudience": 561633,
"rank": 8,
"cinemaChainName": "浙江时代电影院线股份有限公司"
},
{
"totalSales": 2575.06,
"daySession": 12643,
"dayAudience": 537386,
"rank": 9,
"cinemaChainName": "广州金逸珠江电影院线有限公司"
},
{
"totalSales": 2573.47,
"daySession": 16763,
"dayAudience": 576064,
"rank": 10,
"cinemaChainName": "北京华夏联合电影院线"
}
],
"top10Citys": [
{
"totalSales": 1976.43,
"daySession": 10606,
"dayAudience": 429617,
"rank": 1,
"cityName": "成都市"
},
{
"totalSales": 1587.03,
"daySession": 9273,
"dayAudience": 315915,
"rank": 2,
"cityName": "深圳市"
},
{
"totalSales": 1511.68,
"daySession": 8839,
"dayAudience": 312785,
"rank": 3,
"cityName": "广州市"
},
{
"totalSales": 1200.92,
"daySession": 7043,
"dayAudience": 225261,
"rank": 4,
"cityName": "杭州市"
},
{
"totalSales": 1070.88,
"daySession": 5725,
"dayAudience": 231701,
"rank": 5,
"cityName": "西安市"
},
{
"totalSales": 1036.73,
"daySession": 6465,
"dayAudience": 231289,
"rank": 6,
"cityName": "武汉市"
},
{
"totalSales": 972.39,
"daySession": 6499,
"dayAudience": 208691,
"rank": 7,
"cityName": "苏州市"
},
{
"totalSales": 967.23,
"daySession": 5451,
"dayAudience": 209776,
"rank": 8,
"cityName": "长沙市"
},
{
"totalSales": 842.62,
"daySession": 5917,
"dayAudience": 194635,
"rank": 9,
"cityName": "郑州市"
},
{
"totalSales": 767.75,
"daySession": 5119,
"dayAudience": 163562,
"rank": 10,
"cityName": "南京市"
}
],
"top10Cinemas": [
{
"totalSales": 39.81,
"daySession": 48,
"dayAudience": 1912,
"rank": 1,
"cinemaName": "浙江杭州德信影城西溪诚品店"
},
{
"totalSales": 35.45,
"daySession": 121,
"dayAudience": 4297,
"rank": 2,
"cinemaName": "浙江省杭州市浙影时代影城(西湖文化广场店)"
},
{
"totalSales": 34.97,
"daySession": 97,
"dayAudience": 5431,
"rank": 3,
"cinemaName": "北京耀莱成龙国际影城五棵松店"
},
{
"totalSales": 34.15,
"daySession": 107,
"dayAudience": 4748,
"rank": 4,
"cinemaName": "广东省深圳市CINESKY新天影院(壹方天地IMAX店)"
},
{
"totalSales": 34.15,
"daySession": 84,
"dayAudience": 5934,
"rank": 5,
"cinemaName": "福建厦门市万达影城SM店"
},
{
"totalSales": 33.93,
"daySession": 75,
"dayAudience": 6227,
"rank": 6,
"cinemaName": "山东省菏泽市万达影城佳和城店"
},
{
"totalSales": 33.74,
"daySession": 74,
"dayAudience": 5094,
"rank": 7,
"cinemaName": "安徽阜阳市万达影城颍州店"
},
{
"totalSales": 32.55,
"daySession": 62,
"dayAudience": 5941,
"rank": 8,
"cinemaName": "朝阳万达广场店"
},
{
"totalSales": 32.51,
"daySession": 44,
"dayAudience": 2551,
"rank": 9,
"cinemaName": "浙江省杭州市星光嘉映影城IMAX"
},
{
"totalSales": 31.35,
"daySession": 65,
"dayAudience": 5470,
"rank": 10,
"cinemaName": "河南省商丘市万达影城"
}
]
},
"error_code": 0
}
服务级错误码参照(error_code):
错误码 | 说明 | |
---|---|---|
204401 | 网络错误,请重试 |
系统级错误码参照:
错误码 | 说明 | 旧版本(resultcode) | |
---|---|---|---|
10001 | 错误的请求KEY | 101 | |
10002 | 该KEY无请求权限 | 102 | |
10003 | KEY过期 | 103 | |
10004 | 错误的OPENID | 104 | |
10005 | 应用未审核超时,请提交认证 | 105 | |
10007 | 未知的请求源 | 107 | |
10008 | 被禁止的IP | 108 | |
10009 | 被禁止的KEY | 109 | |
10011 | 当前IP请求超过限制 | 111 | |
10012 | 请求超过次数限制 | 112 | |
10013 | 测试KEY超过请求限制 | 113 | |
10014 | 系统内部异常(调用充值类业务时,请务必联系客服或通过订单查询接口检测订单,避免造成损失) | 114 | |
10020 | 接口维护 | 120 | |
10021 | 接口停用 | 121 |
错误码格式说明(示例:200201):
2 | 002 | 01 | |
---|---|---|---|
服务级错误(1为系统级错误) | 服务模块代码(即数据ID) | 具体错误代码 |