bilibili-API-collect icon indicating copy to clipboard operation
bilibili-API-collect copied to clipboard

专栏详细信息获取

Open Colerar opened this issue 2 years ago • 4 comments

可通过专栏对应链接: https://www.bilibili.com/read/cvXXXX HTML返回中的 __INITIAL_STATE__ 获取相关数据。 主要有用的是所属文集rlid以及正文内容. 正则匹配:

window.__INITIAL_STATE__=(\{[\S\s\r\n]+});

分组捕获 $1. 具体结构可见: ArticleDetailedData.kt 返回样本:

{
  "cvid": 15018651,
  "readInfo": {
    "id": 15018651,
    "category": { "id": 5, "parent_id": 2, "name": "动漫资讯" },
    "categories": [
      { "id": 2, "parent_id": 0, "name": "动画" },
      { "id": 5, "parent_id": 2, "name": "动漫资讯" }
    ],
    "title": "皇珈骑士周报\u003C乐刊\u003E第二十七期(01.17-01.23)",
    "summary": "各位皇珈骑士好,这里是皇珈骑士周报第二十七期\u003C乐刊\u003E部分。本周报为珈乐个人向周报,乐刊部分共包动态汇总、直播回顾、直播截图、数据查询四个栏目,专为平时没有时间追直播的骑士们提供一个快速了解珈乐一周动态和当周直播内容的方式~珈乐的个人空间指路:点击这里(已去掉运营代转相关动态)01.17,发动态珈乐Carol的动态-哔哩哔哩 (bilibili.com)01.18,投稿切片珈乐Carol的动态-哔哩哔哩 (bilibili.com)01.19,发动态珈乐Carol的动态-哔哩哔哩 (bilibil",
    "banner_url": "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F5b6417bb299d7aa04e3364382fd4bdc2d4f59e4c.jpg",
    "template_id": 4,
    "state": 7,
    "author": {
      "mid": 1638018482,
      "name": "皇珈骑士周报",
      "face": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F1713110412191271d833421ff033050ddb1cbac5.jpg",
      "pendant": {
        "pid": 33630,
        "name": "珈乐Carol",
        "image": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fgarb\u002Fitem\u002F656119de5098823514b5473f4af7b4f4b44464d0.png",
        "expire": 0
      },
      "official_verify": { "type": -1, "desc": "" },
      "nameplate": {
        "nid": 57,
        "name": "收集萌新",
        "image": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F7767275600ea63d351b22fa87ec15a79aa24e5e5.png",
        "image_small": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F6589d992655595bf51543f268040eaeaed372fae.png",
        "level": "普通勋章",
        "condition": "同时拥有粉丝勋章\u003E=5个"
      },
      "vip": {
        "type": 0,
        "status": 0,
        "due_date": 0,
        "vip_pay_type": 0,
        "theme_type": 0,
        "label": { "path": "", "text": "", "label_theme": "" },
        "avatar_subscript": 0,
        "nickname_color": ""
      }
    },
    "reprint": 0,
    "image_urls": [
      "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Fe80d4588f5e4cbc113506061fa4c7be986cd7ae4.jpg"
    ],
    "publish_time": 1643266660,
    "ctime": 1643266503,
    "stats": {
      "view": 267,
      "favorite": 1,
      "like": 281,
      "dislike": 0,
      "reply": 13,
      "share": 0,
      "coin": 1,
      "dynamic": 0
    },
    "tags": [
      { "tid": 14104, "name": "虚拟偶像" },
      { "tid": 195579, "name": "贝拉" },
      { "tid": 7960745, "name": "VUP" },
      { "tid": 9221368, "name": "向晚" },
      { "tid": 17520266, "name": "嘉然" },
      { "tid": 17532492, "name": "珈乐Carol" },
      { "tid": 17839311, "name": "乃琳" },
      { "tid": 17872743, "name": "珈乐" },
      { "tid": 18478605, "name": "A-SOUL二创激励计划" },
      { "tid": 22668423, "name": "那个女团" }
    ],
    "words": 708,
    "origin_image_urls": [
      "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F61541d5da4614648e1d96f32a722c8c1ac0b28a9.jpg"
    ],
    "list": {
      "id": 510159,
      "mid": 1638018482,
      "name": "皇珈骑士周报总集",
      "image_url": "http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F9346116b67d508f217f3fd6124a4695f1592b2a3.jpg",
      "update_time": 1643337069,
      "ctime": 1642038155,
      "publish_time": 1643337677,
      "summary": "收录从25期往后的新版周报,包括乐刊和骑刊两部分",
      "words": 4866,
      "read": 0,
      "articles_count": 0,
      "state": 3,
      "reason": "",
      "apply_time": "",
      "check_time": ""
    },
    "is_like": false,
    "media": {
      "score": 0,
      "media_id": 0,
      "title": "",
      "cover": "",
      "area": "",
      "type_id": 0,
      "type_name": "",
      "spoiler": 0,
      "season_id": 0
    },
    "apply_time": "",
    "check_time": "",
    "original": 1,
    "act_id": 0,
    "dispute": null,
    "authenMark": null,
    "cover_avid": 0,
    "top_video_info": null,
    "type": 0,
    "content": "正文部分略",
    "keywords": "CAROL,清蒸鲈鱼,哔哩哔哩,直播回顾,解释权,原视频,HTTPS,第一时间,一起玩耍,个人向,小剧场,评论区,怎么做,下雨了,STAFF"
  },
  "readViewInfo": { "total": 34 },
  "upInfo": { "fans": 8950, "readCount": 35055 },
  "catalogList": [],
  "stats": {},
  "actInfo": {},
  "recommendInfoList": [
    {
      "id": 15082530,
      "category": { "id": 5, "parent_id": 2, "name": "动漫资讯" },
      "categories": [
        { "id": 2, "parent_id": 0, "name": "动画" },
        { "id": 5, "parent_id": 2, "name": "动漫资讯" }
      ],
      "title": "这部2021年最强黑马动漫,续作新篇终于来了!",
      "summary": "虽然现在已经2022年都过去一个月了,但是如果让你回忆2021年最让你觉得眼前一亮的动漫,你会想起哪一部呢?我的话大概会想起《奇巧计程车》,作为2021年的4月新番,这部动漫刚开播的时候知道的人其实不太多,毕竟名字和官宣海报就已经是劝退了不少人,我最开始也是被劝退的一个,后来还是朋友强烈推荐我我才看的。这部动漫应该算是一部悬疑题材的作品了,故事主人公原本是一个再平凡不过的计程车司机,他不希望和什么麻烦事有瓜葛,但是好巧不巧的,他和一个女孩的失踪案挂上了关系。他的车载过形形色色的人,而这些人则是和",
      "banner_url": "",
      "template_id": 3,
      "state": 0,
      "author": {
        "mid": 59468008,
        "name": "风筝字幕社",
        "face": "http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Fface\u002F767fc3c5777eb994d6071233ea94198561bc970e.jpg",
        "pendant": { "pid": 0, "name": "", "image": "", "expire": 0 },
        "official_verify": { "type": -1, "desc": "" },
        "nameplate": {
          "nid": 7,
          "name": "见习搬运工",
          "image": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F8478fb7c54026cd47f09daa493a1b1683113a90d.png",
          "image_small": "http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F50eef47c3a30a75659d3cc298cfb09031d1a2ce5.png",
          "level": "普通勋章",
          "condition": "转载视频投稿通过总数\u003E=10"
        },
        "vip": {
          "type": 1,
          "status": 0,
          "due_date": 0,
          "vip_pay_type": 0,
          "theme_type": 0,
          "label": { "path": "", "text": "", "label_theme": "" },
          "avatar_subscript": 0,
          "nickname_color": ""
        }
      },
      "reprint": 0,
      "image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F3b91b58b31db021acb285512ae29937cfb5df20b.jpg",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F7e09f43e22114938d7ed24d546b368c722134592.jpg",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F30b0d9fb0168ba6118b79e1e609286e5cad9115a.png"
      ],
      "publish_time": 1643693759,
      "ctime": 1643693739,
      "stats": {
        "view": 57,
        "favorite": 0,
        "like": 11,
        "dislike": 0,
        "reply": 0,
        "share": 0,
        "coin": 0,
        "dynamic": 0
      },
      "words": 467,
      "origin_image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F3b91b58b31db021acb285512ae29937cfb5df20b.jpg",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F7e09f43e22114938d7ed24d546b368c722134592.jpg",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F30b0d9fb0168ba6118b79e1e609286e5cad9115a.png"
      ],
      "list": {
        "id": 99503,
        "mid": 59468008,
        "name": "动漫资讯",
        "image_url": "",
        "update_time": 1643693739,
        "ctime": 1560590224,
        "publish_time": 1643693759,
        "summary": "",
        "words": 45113,
        "read": 0,
        "articles_count": 0,
        "state": 1,
        "reason": "",
        "apply_time": "",
        "check_time": ""
      },
      "is_like": false,
      "media": {
        "score": 0,
        "media_id": 0,
        "title": "",
        "cover": "",
        "area": "",
        "type_id": 0,
        "type_name": "",
        "spoiler": 0,
        "season_id": 0
      },
      "apply_time": "",
      "check_time": "",
      "original": 1,
      "act_id": 0,
      "dispute": { "dispute": "", "dispute_url": "" },
      "authenMark": null,
      "cover_avid": 0,
      "top_video_info": null,
      "type": 0
    },
    {
      "id": 15082381,
      "category": { "id": 5, "parent_id": 2, "name": "动漫资讯" },
      "categories": [
        { "id": 2, "parent_id": 0, "name": "动画" },
        { "id": 5, "parent_id": 2, "name": "动漫资讯" }
      ],
      "title": "虎杖悠仁声优榎木淳弥感染新冠病毒。",
      "summary": "日本声优榎木淳弥感染新冠病毒。 1月31日凌晨感到发热和不适,去做PCR检查,核酸检测呈阳性。 榎木淳弥代表作有《卡片战斗先导者G》绮场圣苑、《樱子小姐的脚下埋着尸体》馆胁正太郎、《JOJO的奇妙冒险:黄金之风》潘纳科达·福葛、《数码宝贝大冒险tri.》高石岳(阿武)、《机动战士高达NT》乔纳·巴修塔、《总之就是非常可爱》由崎星空、《咒术回战》虎杖悠仁、《2.43清阴高中男子排球社》黑羽祐仁等。曾在广播《安済知佳 いちかばちか》中公布声优安济知佳为自己的表妹。",
      "banner_url": "",
      "template_id": 3,
      "state": 0,
      "author": {
        "mid": 1875333,
        "name": "冬の星雨",
        "face": "http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fface\u002F19726be4459cab631438df9a33173c6a5073ca77.jpg",
        "pendant": { "pid": 0, "name": "", "image": "", "expire": 0 },
        "official_verify": { "type": -1, "desc": "" },
        "nameplate": {
          "nid": 0,
          "name": "",
          "image": "",
          "image_small": "",
          "level": "",
          "condition": ""
        },
        "vip": {
          "type": 1,
          "status": 0,
          "due_date": 0,
          "vip_pay_type": 0,
          "theme_type": 0,
          "label": { "path": "", "text": "", "label_theme": "" },
          "avatar_subscript": 0,
          "nickname_color": ""
        }
      },
      "reprint": 0,
      "image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F0e5b80e257249d68b712b6743243939e97a08bfc.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F3f27eda33037dea4ef599e5a518a52c94ba012b8.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F45093aa24cd71fc9da1f65099accf65940ac368d.png"
      ],
      "publish_time": 1643692584,
      "ctime": 1643692571,
      "stats": {
        "view": 167,
        "favorite": 0,
        "like": 16,
        "dislike": 0,
        "reply": 7,
        "share": 1,
        "coin": 0,
        "dynamic": 0
      },
      "words": 229,
      "origin_image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F0e5b80e257249d68b712b6743243939e97a08bfc.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F3f27eda33037dea4ef599e5a518a52c94ba012b8.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F45093aa24cd71fc9da1f65099accf65940ac368d.png"
      ],
      "list": {
        "id": 146942,
        "mid": 1875333,
        "name": "声优偶像",
        "image_url": "http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Fe807fffb515864f91800b2c6c009aa38b0a3c334.png",
        "update_time": 1643693797,
        "ctime": 1571535234,
        "publish_time": 1643693797,
        "summary": "介绍相关声优最近的现状",
        "words": 68638,
        "read": 0,
        "articles_count": 0,
        "state": 1,
        "reason": "",
        "apply_time": "",
        "check_time": ""
      },
      "is_like": false,
      "media": {
        "score": 0,
        "media_id": 0,
        "title": "",
        "cover": "",
        "area": "",
        "type_id": 0,
        "type_name": "",
        "spoiler": 0,
        "season_id": 0
      },
      "apply_time": "",
      "check_time": "",
      "original": 1,
      "act_id": 0,
      "dispute": { "dispute": "", "dispute_url": "" },
      "authenMark": null,
      "cover_avid": 0,
      "top_video_info": null,
      "type": 0
    },
    {
      "id": 15082538,
      "category": { "id": 5, "parent_id": 2, "name": "动漫资讯" },
      "categories": [
        { "id": 2, "parent_id": 0, "name": "动画" },
        { "id": 5, "parent_id": 2, "name": "动漫资讯" }
      ],
      "title": "声优佐仓绫音今日宣布从事务所 I'm Enterprise 移籍青二事务所。",
      "summary": "2022年2月1日声优佐仓绫音宣布从事务所 I'm Enterprise 移籍青二事务所。佐仓绫音2009年4月1日加入I'm Enterprise,2010年在剧场版动画《Keroro军曹5:诞生!究极Keroro奇迹的时空岛》中作为声优出道,在《大神与七位伙伴》中首次出演TV动画,整整12年的时间,从萌新到现在的专业成熟,想必是为了更好的对事业追求和挑战才换的事务所。(某神后宫-1)声优悠木碧也选择在今天1月正式加入了青二事务所。",
      "banner_url": "",
      "template_id": 3,
      "state": 0,
      "author": {
        "mid": 1875333,
        "name": "冬の星雨",
        "face": "http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fface\u002F19726be4459cab631438df9a33173c6a5073ca77.jpg",
        "pendant": { "pid": 0, "name": "", "image": "", "expire": 0 },
        "official_verify": { "type": -1, "desc": "" },
        "nameplate": {
          "nid": 0,
          "name": "",
          "image": "",
          "image_small": "",
          "level": "",
          "condition": ""
        },
        "vip": {
          "type": 1,
          "status": 0,
          "due_date": 0,
          "vip_pay_type": 0,
          "theme_type": 0,
          "label": { "path": "", "text": "", "label_theme": "" },
          "avatar_subscript": 0,
          "nickname_color": ""
        }
      },
      "reprint": 0,
      "image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Ff1d6396425af78b4d73785a77964e856d41e0f9d.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Fa7cae99da99e231d8668794bc89a48482309f029.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F030275634f09f89237fefc1748df75b38f1eecb2.png"
      ],
      "publish_time": 1643693797,
      "ctime": 1643693797,
      "stats": {
        "view": 324,
        "favorite": 2,
        "like": 17,
        "dislike": 0,
        "reply": 1,
        "share": 0,
        "coin": 0,
        "dynamic": 0
      },
      "words": 215,
      "origin_image_urls": [
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Ff1d6396425af78b4d73785a77964e856d41e0f9d.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Fa7cae99da99e231d8668794bc89a48482309f029.png",
        "https:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002F030275634f09f89237fefc1748df75b38f1eecb2.png"
      ],
      "list": {
        "id": 146942,
        "mid": 1875333,
        "name": "声优偶像",
        "image_url": "http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farticle\u002Fe807fffb515864f91800b2c6c009aa38b0a3c334.png",
        "update_time": 1643693797,
        "ctime": 1571535234,
        "publish_time": 1643693797,
        "summary": "介绍相关声优最近的现状",
        "words": 68638,
        "read": 0,
        "articles_count": 0,
        "state": 1,
        "reason": "",
        "apply_time": "",
        "check_time": ""
      },
      "is_like": false,
      "media": {
        "score": 0,
        "media_id": 0,
        "title": "",
        "cover": "",
        "area": "",
        "type_id": 0,
        "type_name": "",
        "spoiler": 0,
        "season_id": 0
      },
      "apply_time": "",
      "check_time": "",
      "original": 1,
      "act_id": 0,
      "dispute": { "dispute": "", "dispute_url": "" },
      "authenMark": null,
      "cover_avid": 0,
      "top_video_info": null,
      "type": 0
    }
  ]
}

Colerar avatar Feb 01 '22 07:02 Colerar

感谢dalao提供

SocialSisterYi avatar Feb 01 '22 16:02 SocialSisterYi

似乎直播间更新了人气值的显示, 通过API获取的和网页上显示的对不上. 而新的人气值也可通过这个issue类似的方法获取.

cxw620 avatar Mar 11 '22 16:03 cxw620

@cxw620 此方法应该广泛存在于 B 站的 html 返回中。主要目的应该是减少访问 API 次数。很多没做或者没来得及做「动态更新」的字段应该也可以通过这个方法获取。 此外获取人气值比较合理的做法应该是建立 WSS 链接,解析 B 站的发包,不过这个 repo 里关于 WSS 消息流的信息比较少。

Colerar avatar Mar 11 '22 16:03 Colerar

@cxw620 此方法应该广泛存在于 B 站的 html 返回中。主要目的应该是减少访问 API 次数。很多没做或者没来得及做「动态更新」的字段应该也可以通过这个方法获取。 此外获取人气值比较合理的做法应该是建立 WSS 链接,解析 B 站的发包,不过这个 repo 里关于 WSS 消息流的信息比较少。

了解, 谢dalao. 关于wss信息流我再研究看看.

cxw620 avatar Mar 11 '22 18:03 cxw620