y-young / nazurin

🎉 Images collection done right. Telegram 图片收藏机器人 / A Telegram bot that helps you collect ACG illustrations.
http://nazurin.readthedocs.io
MIT License
260 stars 58 forks source link

B站获取动态信息的 API 已失效 #88

Closed orilights closed 8 months ago

orilights commented 8 months ago

Describe the bug

B站获取动态卡片信息的 API 目前不带 Cookie 拿不到数据了,有什么办法修复吗,或者可以加一个环境变量填B站的 Cookie 吗

话题和动态相关接口失效

image image

orilights commented 8 months ago

发现了另外一个接口,不需要 Cookie,只要传个UA就行,不知道符不符合要求

获取动态详情|BAC Document

请求

curl -L -X GET 'https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?id=875676486597607465' --user-agent 'Mozilla/5.0'

响应

{
    "code": 0,
    "message": "0",
    "ttl": 1,
    "data": {
        "item": {
            "basic": {
                "comment_id_str": "297736770",
                "comment_type": 11,
                "like_icon": {
                    "action_url": "",
                    "end_url": "",
                    "id": 0,
                    "start_url": ""
                },
                "rid_str": "297736770"
            },
            "id_str": "875676486597607465",
            "modules": {
                "module_author": {
                    "avatar": {
                        "container_size": {
                            "height": 1.35,
                            "width": 1.35
                        },
                        "fallback_layers": {
                            "is_critical_group": true,
                            "layers": [
                                {
                                    "general_spec": {
                                        "pos_spec": {
                                            "axis_x": 0.675,
                                            "axis_y": 0.675,
                                            "coordinate_pos": 2
                                        },
                                        "render_spec": {
                                            "opacity": 1
                                        },
                                        "size_spec": {
                                            "height": 1,
                                            "width": 1
                                        }
                                    },
                                    "layer_config": {
                                        "is_critical": true,
                                        "tags": {
                                            "AVATAR_LAYER": {},
                                            "GENERAL_CFG": {
                                                "config_type": 1,
                                                "general_config": {
                                                    "web_css_style": {
                                                        "borderRadius": "50%"
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    "resource": {
                                        "res_image": {
                                            "image_src": {
                                                "placeholder": 6,
                                                "remote": {
                                                    "bfs_style": "widget-layer-avatar",
                                                    "url": "https://i1.hdslb.com/bfs/face/2563477f460f77dac5a055b11dfcfdffc3d0986e.jpg"
                                                },
                                                "src_type": 1
                                            }
                                        },
                                        "res_type": 3
                                    },
                                    "visible": true
                                },
                                {
                                    "general_spec": {
                                        "pos_spec": {
                                            "axis_x": 0.8000000000000002,
                                            "axis_y": 0.8000000000000002,
                                            "coordinate_pos": 1
                                        },
                                        "render_spec": {
                                            "opacity": 1
                                        },
                                        "size_spec": {
                                            "height": 0.41666666666666663,
                                            "width": 0.41666666666666663
                                        }
                                    },
                                    "layer_config": {
                                        "tags": {
                                            "GENERAL_CFG": {
                                                "config_type": 1,
                                                "general_config": {
                                                    "web_css_style": {
                                                        "background-color": "rgb(255,255,255)",
                                                        "border": "2px solid rgba(255,255,255,1)",
                                                        "borderRadius": "50%",
                                                        "boxSizing": "border-box"
                                                    }
                                                }
                                            },
                                            "ICON_LAYER": {}
                                        }
                                    },
                                    "resource": {
                                        "res_image": {
                                            "image_src": {
                                                "local": 1,
                                                "src_type": 2
                                            }
                                        },
                                        "res_type": 3
                                    },
                                    "visible": true
                                }
                            ]
                        },
                        "mid": "102674863"
                    },
                    "face": "https://i1.hdslb.com/bfs/face/2563477f460f77dac5a055b11dfcfdffc3d0986e.jpg",
                    "face_nft": false,
                    "following": null,
                    "jump_url": "//space.bilibili.com/102674863/dynamic",
                    "label": "",
                    "mid": 102674863,
                    "name": "特日日世界第一可矮",
                    "official_verify": {
                        "desc": "",
                        "type": -1
                    },
                    "pendant": {
                        "expire": 0,
                        "image": "",
                        "image_enhance": "",
                        "image_enhance_frame": "",
                        "n_pid": 0,
                        "name": "",
                        "pid": 0
                    },
                    "pub_action": "",
                    "pub_location_text": "",
                    "pub_time": "2023年12月16日 18:32",
                    "pub_ts": 1702722720,
                    "type": "AUTHOR_TYPE_NORMAL",
                    "vip": {
                        "avatar_subscript": 1,
                        "avatar_subscript_url": "",
                        "due_date": 1715702400000,
                        "label": {
                            "bg_color": "#FB7299",
                            "bg_style": 1,
                            "border_color": "",
                            "img_label_uri_hans": "",
                            "img_label_uri_hans_static": "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png",
                            "img_label_uri_hant": "",
                            "img_label_uri_hant_static": "https://i0.hdslb.com/bfs/activity-plat/static/20220614/e369244d0b14644f5e1a06431e22a4d5/VEW8fCC0hg.png",
                            "label_theme": "annual_vip",
                            "path": "",
                            "text": "年度大会员",
                            "text_color": "#FFFFFF",
                            "use_img_label": true
                        },
                        "nickname_color": "#FB7299",
                        "status": 1,
                        "theme_type": 0,
                        "type": 2
                    }
                },
                "module_dynamic": {
                    "additional": null,
                    "desc": {
                        "rich_text_nodes": [
                            {
                                "orig_text": "画都画了 发一下(¦3【▓▓】",
                                "text": "画都画了 发一下(¦3【▓▓】",
                                "type": "RICH_TEXT_NODE_TYPE_TEXT"
                            }
                        ],
                        "text": "画都画了 发一下(¦3【▓▓】"
                    },
                    "major": {
                        "draw": {
                            "id": 297736770,
                            "items": [
                                {
                                    "height": 7541,
                                    "size": 12514.91,
                                    "src": "https://i0.hdslb.com/bfs/new_dyn/158bb0098a56e67fda2705fa5c2fd46b102674863.jpg",
                                    "tags": [],
                                    "width": 2902
                                }
                            ]
                        },
                        "type": "MAJOR_TYPE_DRAW"
                    },
                    "topic": null
                },
                "module_more": {
                    "three_point_items": [
                        {
                            "label": "举报",
                            "type": "THREE_POINT_REPORT"
                        }
                    ]
                },
                "module_stat": {
                    "comment": {
                        "count": 62,
                        "forbidden": false
                    },
                    "forward": {
                        "count": 119,
                        "forbidden": false
                    },
                    "like": {
                        "count": 1827,
                        "forbidden": false,
                        "status": false
                    }
                }
            },
            "type": "DYNAMIC_TYPE_DRAW",
            "visible": true
        }
    }
}