#1 - 2024-3-31 11:14
白杨只需保持自己模样 (花坂结衣爱我一生!)
想导出动画信息,请问有没有啥快速方法
#2 - 2024-3-31 11:24
(二次元、玩家。)
#3 - 2024-3-31 13:24
https://github.com/bangumi/Archive
你的需求下载备份数据比较好
#4 - 2024-3-31 13:37
bangumi takeout
#5 - 2024-3-31 15:56
(心脏要逃走了。)
https://bangumi.github.io/api/
import requests
import json

def get_bangumi_collections(user_id, access_token, limit=50):
    base_url = "https://api.bgm.tv/v0/users"
    collections_endpoint = f"{base_url}/{user_id}/collections"

    headers = {
        'Authorization': 'Bearer ' + access_token,
        'accept': 'application/json',
        'User-Agent': 'Adachi/BangumiMigrate(https://github.com/Adachi-Git)'
    }

    all_collections = []
    offset = 0

    while True:
        params = {
            'subject_type': 2,  # Anime
            'limit': limit,
            'offset': offset
        }

        response = requests.get(collections_endpoint, headers=headers, params=params)

        if response.status_code == 200:
            data = response.json()
            total = data.get('total', 0)

            if total == 0:
                print("No Bangumi collections found.")
                break

            all_collections.extend(data.get('data', []))

            if len(all_collections) >= total:
                print(f"Total number of Bangumi collections: {total}")
                break

            offset += limit
        else:
            print(f"Failed to fetch Bangumi collections. Status code: {response.status_code}")
            break

    # 输出到默认的 JSON 文件中
    output_filename = 'bangumi_collections.json'
    with open(output_filename, 'w', encoding='utf-8') as json_file:
        json.dump(all_collections, json_file, ensure_ascii=False, indent=2)

    print(f"Bangumi collections saved to {output_filename}")
    return all_collections

import requests
import json


if __name__ == "__main__":
    user_id = "adachi9"
    access_token = ""
    get_bangumi_collections(user_id, access_token, limit=50)
#6 - 2024-4-2 17:42
(ヾ(•ω•`)o)
有的,详见楼上,但部分功能api并没有覆盖或者实现比较麻烦,比如作品的好友评分或者作品相关目录等等,这些还是建议要实现的话直接爬网页(bgm38)
#6-1 - 2024-4-3 10:07
白杨只需保持自己模样
是的,本来想的就是没api就自己写爬虫(看了眼api感觉不太行,勉强先用着...)
#6-2 - 2024-4-3 10:13
klion
白杨只需保持自己模样 说: 是的,本来想的就是没api就自己写爬虫(看了眼api感觉不太行,勉强先用着...)
你需要什么数据, 我可能有
#6-3 - 2024-4-4 18:21
白杨只需保持自己模样
klion 说: 你需要什么数据, 我可能有
已经想办法拿到了,谢谢你的好意
#6-4 - 2024-4-4 19:31
klion
白杨只需保持自己模样 说: 已经想办法拿到了,谢谢你的好意
你要用这些数据做啥啊
#6-5 - 2024-4-6 12:47
白杨只需保持自己模样
klion 说: 你要用这些数据做啥啊
做个番剧推荐程序,拿来玩
#6-6 - 2024-4-6 13:00
klion
白杨只需保持自己模样 说: 做个番剧推荐程序,拿来玩
我做过,可以一块来加强 https://bangrecs.net
#6-7 - 2024-4-7 10:03
白杨只需保持自己模样
klion 说: 我做过,可以一块来加强 https://bangrecs.net
大佬牛逼!