{"id":20644941,"url":"https://github.com/tickstep/aliyunpan-api","last_synced_at":"2025-10-24T06:47:32.202Z","repository":{"id":41498799,"uuid":"386943345","full_name":"tickstep/aliyunpan-api","owner":"tickstep","description":"阿里云盘API","archived":false,"fork":false,"pushed_at":"2025-02-24T13:58:11.000Z","size":281,"stargazers_count":81,"open_issues_count":0,"forks_count":21,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T16:05:30.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tickstep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-17T13:20:18.000Z","updated_at":"2025-03-24T08:26:27.000Z","dependencies_parsed_at":"2024-11-10T04:17:51.253Z","dependency_job_id":"0c899f0e-4527-426f-a148-9d0224673781","html_url":"https://github.com/tickstep/aliyunpan-api","commit_stats":{"total_commits":156,"total_committers":5,"mean_commits":31.2,"dds":0.3205128205128205,"last_synced_commit":"3c6b2d286473bc6f4e7f181e4aa432eb24d2ef84"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tickstep%2Faliyunpan-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tickstep%2Faliyunpan-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tickstep%2Faliyunpan-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tickstep%2Faliyunpan-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tickstep","download_url":"https://codeload.github.com/tickstep/aliyunpan-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217172,"owners_count":20903008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T16:18:08.343Z","updated_at":"2025-10-24T06:47:32.080Z","avatar_url":"https://github.com/tickstep.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aliyunpan-api\nGO语言封装的 aliyunpan 阿里云盘官方OpenAPI接口和网页端Web接口。你可以基于该接口库实现对阿里云盘的二次开发。   \n两种接口都可以实现对阿里云盘的文件访问，但是由于阿里OpenAPI目前接口开放有限，有部分功能只有web端接口具备，例如：分享、相册等。你可以根据需要自行选择，也可以两者融合使用。\n\n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/tickstep/aliyunpan-api?tab=doc)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/modern-go/concurrent/master/LICENSE)\n\n# 关于登录Token\n阿里官方OpenAPI的登录和网页版Web登录token是不一样的，方式也不一样，本仓库并没有这部分代码，你需要自行实现。\n1. 阿里官方OpenAPI的登录token，可以参考官方文档：https://www.yuque.com/aliyundrive/zpfszx/btw0tw\n2. 网页版Web的登录token，可以通过使用浏览器获取到的RefreshToken进行获取，样例如下：\n```\n\t// get access token\n\trefreshToken := \"f34b54eba1...706f389\"\n\twebToken, err := aliyunpan_web.GetAccessTokenFromRefreshToken(refreshToken)\n\tif err != nil {\n\t\tfmt.Println(\"get web acccess token error\")\n\t\treturn\n\t}\n```\n\n# 快速使用教程\n## 阿里官方OpenAPI接口\n导入包\n```\nimport \"github.com/tickstep/aliyunpan-api/aliyunpan\"\nimport \"github.com/tickstep/aliyunpan-api/aliyunpan_open\"\n```\n\n使用授权登录后得到的AccessToken创建OpenPanClient实例\n```\n\topenPanClient := aliyunpan_open.NewOpenPanClient(openapi.ApiConfig{\n\t\tTicketId:     \"\",\n\t\tUserId:       \"\",\n\t\tClientId:     \"\",\n\t\tClientSecret: \"\",\n\t}, openapi.ApiToken{\n\t\tAccessToken: \"eyJraWQiOiJLcU8iLC...jIUeqP9mZGZDrFLN--h1utcyVc\",\n\t\tExpiredAt:   1709527182,\n\t}, nil)\n```\n\n调用OpenPanClient相关方法可以实现对阿里云盘的相关操作\n```\n\t// get user info\n\tui, err := openPanClient.GetUserInfo()\n\tif err != nil {\n\t\tfmt.Println(\"get user info error\")\n\t\treturn\n\t}\n\tfmt.Println(\"当前登录用户：\" + ui.Nickname)\n\n\t// do some file operation\n\tfi, _ := openPanClient.FileInfoByPath(ui.FileDriveId, \"/我的文档\")\n\tfmt.Println(\"\\n我的文档 信息：\")\n\tfmt.Println(fi)\n```\n\n## 网页版Web端接口\n导入包\n```\nimport \"github.com/tickstep/aliyunpan-api/aliyunpan\"\nimport \"github.com/tickstep/aliyunpan-api/aliyunpan_web\"\n```\n\n使用浏览器获取到的RefreshToken创建WebPanClient实例\n```\n\t// get access token\n\trefreshToken := \"f34b54eba1...706f389\"\n\twebToken, err := aliyunpan_web.GetAccessTokenFromRefreshToken(refreshToken)\n\tif err != nil {\n\t\tfmt.Println(\"get acccess token error\")\n\t\treturn\n\t}\n\t\n\t// web pan client\n\tappConfig := aliyunpan_web.AppConfig{\n\t\tAppId: \"25dzX3vbYqktVxyX\",\n\t\tDeviceId: \"T6ZJyY7JqX6EN2cDzLCxMVYZ\",\n\t\tUserId:    \"\",\n\t\tNonce:     0,\n\t\tPublicKey: \"\",\n\t}\n\twebPanClient := aliyunpan_web.NewWebPanClient(*webToken, aliyunpan_web.AppLoginToken{}, appConfig, aliyunpan_web.SessionConfig{\n\t\tDeviceName: \"Chrome浏览器\",\n\t\tModelName:  \"Windows网页版\",\n\t})\n\n\t// create session\n\twebPanClient.CreateSession(\u0026aliyunpan_web.CreateSessionParam{\n\t\tDeviceName: \"Chrome浏览器\",\n\t\tModelName:  \"Windows网页版\",\n\t})\n\n```\n\n调用WebPanClient相关方法可以实现对阿里云盘的相关操作\n```\n\t// get user info\n\tui, err := webPanClient.GetUserInfo()\n\tif err != nil {\n\t\tfmt.Println(\"get user info error\")\n\t\treturn\n\t}\n\tfmt.Println(\"当前登录用户：\" + ui.Nickname)\n\n\t// do some file operation\n\tfi, _ := webPanClient.FileInfoByPath(ui.FileDriveId, \"/我的文档\")\n\tfmt.Println(\"\\n我的文档 信息：\")\n\tfmt.Println(fi)\n```\n\n# 链接\n\u003e [tickstep/aliyunpan](https://github.com/tickstep/aliyunpan)   \n\u003e [阿里OpenAPI文档](https://www.yuque.com/aliyundrive/zpfszx/btw0tw)   ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftickstep%2Faliyunpan-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftickstep%2Faliyunpan-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftickstep%2Faliyunpan-api/lists"}