Blog

Acfun api

2019-12-31

#Acfun
#Acsign

一些关于acfun的api

登录相关

登录相关的接口就两个,移动端和网页端

网页登录

Request

  • Method: POST
  • URL: https://id.app.acfun.cn/rest/web/login/signin
  • Headers:
    • Content-Type: application/x-www-form-urlencoded
  • Body:
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD",
    "key": null,
    "captcha": null

Response

  • Body
    • success
    {
      "result": 0,
      "img": "YOUR_AVATAR",
      "userId": 1,
      "username": "YOUR_USERNAME"
    }
    
    • failure
    {
      "result": 100001005,
      "error_msg": "帐号不存在或密码错误"
    }
    
    {
      "result":100001016,
      "error_msg":"图片验证码错误"
    }
    

注:只有短期内多次登录才需要输入验证码,所以keycaptcha只需留空,key获取登录验证码有关,captcha即图片验证码在视觉上所展示的由26个英文字母及10个阿拉伯数字组成的4位字符串;userid为用户uid

客户端登录(旧)

Request

  • Method: POST
  • URL: http://account.app.acfun.cn/api/account/signin/normal
  • Headers:
    • Content-Type: application/x-www-form-urlencoded
  • Body:
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD",
    "cid": "ELSH6ruK0qva88DD"

Response

  • Body
    • success
      {
        "name": "VDATA",
        "url": "",
        "errorid": 0,
       "errordesc": "",
        "vdata": 
          {
            "token": "[ACCESS_TOKEN]",
            "expiration": 1556779288,
            "check_password": 0,
            "check_real": 0,
            "oauth": 0,
            "acPasstoken": "[ACPASSTOKEN]",
            "acSecurity": "[ACSECURITY]",
            "acPostHint": "[ACPOSTHINT]",
            "passCheck": true,
            "s2s-code": "[S2S-CODE]",
            "info": 
            {
               "avatar": "http: \/\/cdn.aixifan.com\/dotnet\/artemis\/u\/cms\/www\/201806\/XXXX.jpg",
               "username": "[YOUR_USERNAME]",
               "userid": 1,
               "mobile": "",
               "group-level": 1,
               "mobile-check": 0
            }
          },
        "version": "1.0"
      }
    
    • failure
    {
      "name": "VDATA",
      "url": "",
      "errorid": 18165,
      "errordesc": "帐号不存在或密码错误",
       "vdata": [],
       "version": "1.0"
    }
    

注:cid的值固定不变,userid1只为表明其类型为整型,expiration是token失效时刻

客户端登录(新)

Request

  • Method: POST
  • URL: https://id.app.acfun.cn/rest/app/login/signin
  • Headers:
    • deviceType: 1
  • Body:
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD"

Response

  • Body
    • success
      {
        "mobile-check": 0,
        "group-level": 1,
        "acPassToken": "[ACPASSTOKEN]",
        "mobile": null,
        "avatar": "https://imgs.aixifan.com/xxx",
        "auth_key": "[USERID]",
        "userid": "[USERID]",
        "first_login": false,
        "token": "[ACCESS_TOKEN]",
        "check_real": 0,
        "result": 0,
        "acSecurity": "ACSECURITY",
        "check_password": 0,
        "passCheck": true,
        "username": "[YOUR_USERNAME]"
      }
    
    • failure
    {
      "result": 100001005,
      "error_msg": "帐号不存在或密码错误"
    }
    

检查签到

网页端检查签到

Request

  • Method: GET
  • URL: http://www.acfun.cn/webapi/record/actions/signin?channel=0
  • Headers:
    • Cookie: YOUR_COOKIE

Response

  • Body
{
  "code": 200,
  "data":true,
  "message": "OK"
}

客户端检查签到(旧)

Request

  • Method: POST
  • URL: http://api.new-app.acfun.cn/rest/app/user/hasSignedIn
  • Headers:
    • Content-Type: application/x-www-form-urlencoded
    • acPlatform: ANDROID_PHONE
    • appVersion: 6.1.1.740
    • Cookie:
      • auth_key: YOUR_UID;
      • acPasstoken: YOUR_ACPASSTOKEN;
  • Body:
    "access_token": "YOUR_ACCESS_TOKEN"

Response

  • Body
{
  "result": 0,
  "hasSignedIn": true,
  "host-name": "hb2-acfun-kcs075.aliyun",
  "continuousDays": 0
}

客户端检查签到(新)

Request

  • Method: POST
  • URL: https://api-new.acfunchina.com/rest/app/user/hasSignedIn
  • Headers:
    • Cookie:
      • auth_key: YOUR_UID;
      • acPasstoken: YOUR_ACPASSTOKEN;
  • Body:
    "access_token": "YOUR_ACCESS_TOKEN"

Response

  • Body
{
  "result": 0,
  "hasSignedIn": true,
  "cumulativeDays": 284,
  "host-name": "hb2-acfun-kcs169.aliyun",
  "continuousDays": 1
}

注:cumulativeDays为合计时长,continuousDays为连签时长

签到

网页端(旧)

Request

  • Method: POST
  • URL: http://www.acfun.cn/webapi/record/actions/signin?channel=0
  • Headers:
    • Cookie: YOUR_COOKIE

Response

  • Body
    • success
    {
      "code": 200,
      "data":
        {
          "count": 3,
          "msg": "签到已成功,领取3蕉"
        },
      "message": "OK"
    }
    
    • failure
    {
      "code":410004,
      "message":"已签过到"
    }
    
    • GET
    {
      "code": 200,
      "data":true,
      "message": "OK"
    }
    

网页端(新)

Request

  • Method: POST
  • URL: https://www.acfun.cn/nd/pst?locationPath=signin&certified=[STRING]&channel=0&data=
  • Headers:
    • Cookie:
      • YOUR_COOKIE;
      • stochastic: STRING

Response

  • Body
    • success
    {
      "code": 200,
      "data":
        {
          "count": 3,
          "msg": "签到已成功,领取3蕉"
        },
      "message": "OK"
    }
    
    • failure
    {
      "code": 410004,
      "message": "已签过到"
    }
    
    {
      "code": -1,
      "msg": "用户校验失败"
    }
    

注:为stochastic所赋的值STRING可为空,只需保证cookie中stochastic与URL中certified值相等即可

客户端(旧)

Request

  • Method: POST
  • URL: http://api.new-app.acfun.cn/rest/app/user/signIn
  • Headers:
    • Content-Type: application/x-www-form-urlencoded
    • acPlatform: ANDROID_PHONE
    • appVersion: 6.1.1.740
    • Cookie:
      • auth_key: YOUR_UID;
      • acPasstoken: YOUR_ACPASSTOKEN;
  • Body:
    "access_token": "YOUR_ACCESS_TOKEN"

Response

  • Body
    • success
    {
      "result": 0,
      "msg": "签到成功,领取6蕉",
      "bananaDelta": 6,
      "host-name": "hb2-acfun-kcs026.aliyun",
      "continuousDays": 1
    }
    
    • failure
    {
      "result": 122,
      "msg": "今日已签到",
      "error_msg": "今日已签到",
      "host-name": "hb2-acfun-kcs045.aliyun"
    }
    

客户端(新)

Request

  • Method: POST
  • URL: https://api-new.acfunchina.com/rest/app/user/signIn
  • Headers:
    • acPlatform: ANDROID_PHONE
    • Cookie:
      • auth_key: YOUR_UID;
      • acPasstoken: YOUR_ACPASSTOKEN;
  • Body:
    "access_token": "YOUR_ACCESS_TOKEN"

Response

  • Body
    • success
    {
      "result": 0,
      "msg": "签到成功,领取6蕉",
      "bananaDelta": 6,
      "host-name": "hb2-acfun-kcs023.aliyun",
      "almanac":
        {
          "todayRecoGuideMsg": "你们城里人真会看片",
          "todayRecoResourceId": "5024920",
          "todayRecoResourceType": 1,
          "guideMsg": "分享一下还有惊喜哦~",
          "fortune": "小吉",
          "suits":
            [
              "打桌游",
              "在胡同里狂奔",
              "结识新朋友"
            ],
          "avoids":
            [
              "符咒贴在脑门",
              "消消乐",
              "九点去买海鲜"
            ]
        },
        "continuousDays": 1
      }
    
    • failure
    {
      "result": 122,
      "msg": "今日已签到",
      "error_msg": "今日已签到",
      "host-name": "hb2-acfun-kcs045.aliyun"
    }
    

投蕉

网页端

Request

  • Method: POST
  • URL: https://www.acfun.cn/banana/throwBanana.aspx
  • Headers:
    • Cookie: YOUR_COOKIE
  • Body:
    "contentId": "[ACID]"
    "count": "[THROW_BANANA_COUNT]"
    "userId": "[USERID]"

Response

  • Body
    • success
    {
      "success": true,
      "result": "操作成功",
      "info": "操作成功",
      "status": 200
    }
    
    • failure
    {
      "success": false,
      "result": "该稿件已扔过香蕉",
      "info": "该稿件已扔过香蕉",
      "status": 400
    }
    
    {
      "success": false,
      "result": "赠予香蕉数量错误",
      "info": "赠予香蕉数量错误",
      "status": 400
    }
    

注:contentId为被投稿的ac编号;count为投蕉数量,取值应在区间1,5userId为用户UID

检查在线状态

网页端

Request

  • Method: GET
  • URL: http://www.acfun.cn/online.aspx
  • Headers:
    • Cookie: YOUR_COOKIE

Response

  • Body
    • success
    {
      "success": true,
      "isdisabled": false,
      "level": "[YOUR_LEVEL]",
      "status": 200,
      "duration": "[YOUR_DURATION]"
    }
    
    • failure
    {
      "success": false,
      "isdisabled": false,
      "level": 0,
      "status": 401,
      "duration": 0,
      "result": "请先登陆",
      "info": "请先登陆"
    }
    

获取登录验证码

网页端/客户端

Request

  • Method: GET
  • URL:
    • https://id.app.acfun.cn/rest/web/login/captcha
    • https://id.app.acfun.cn/rest/app/login/captcha

Response

  • Body
    • success
    {
      "result":0,
      "image":"data:image/png;base64,...",
      "key":"[KEY]"
    }
    

    注:key值与网页登录关联,客户端与网页返回的结果结构一致
    • failure (待补全)

评论区