🚀🔥使用Python连接阿里云盘, 实现了官方大部分功能 👍👍

Overview

aligo

🚀 🔥 使用Python连接阿里云盘, 实现了官方大部分功能 👍 👍

python version Downloads

为了完善代码提示, 方便大家代码书写, aligo 引入了一些 python 3.8 的新特性, 所以要求 python >= 3.8.*

pip install aligo

pip install aligo -i https://pypi.org/simple

必要时可以加个 --upgrade-U 参数

快速入门

from aligo import Aligo

ali = Aligo()

# 获取用户信息
user = ali.get_user()

# 获取网盘根目录文件列表
ll = ali.get_file_list()

基本功能

  1. 登录

    • 扫描二维码登录

      # 导包, 这里为了方便演示, 导入全部
      from aligo import *
      
      # 创建身份认证对象
      # 所有参数可选, 默认二维码扫码登录, 推荐
      auth = Auth()
      
      # 如需自定义二维码显示方式, 可指定一个函数, 详情参考源码
      # auth = Auth(show=show_qrcode)
    • refresh_token 登录

      # 也可使用 refresh_token 验证登录
      auth = Auth(refresh_token='')
      
      # refresh_token 参数可在 Chrome -> F12 -> Application -> Local Storage -> token 中寻找
    • 持久化登录

      # aligo 支持自动自动刷新 access_token
      # 所以不是每次使用都需要登录的
      # aligo 会将 token 信息保存到 /.aligo 目录下的配置文件中
      # 配置文件名为 .json, name 通过一下方式提供, 默认为 'aligo'
      
      auth = Auth(name='aligo')
  2. 获取信息

    • 获取用户信息

      # 创建 Auth 对象之后, 再创建 Aligo 对象, 剩下的就是方法调用了
      # 需要提供一个 Auth 对象, 可选, 默认 Auth()
      ali = Aligo()
      user = ali.get_user()
      
      # user 是一个 BaseUser 对象, 详情参考源码, 非常简单😁
    • 获取网盘信息

      # 比如获取 云盘容量 信息
      drive_info = ali.get_personal_info()

      image-20210731202528336

  3. 功能太多, 就不一一列举, 大致如下

    • 扫码登录
    • refresh_token登录
    • 持久化登录
    • 获取用户信息
    • 获取云盘信息
    • 获取文件信息
    • 批量获取文件下载地址
    • 根据路径获取文件
    • 获取文件列表
    • 批量下载/上传文件(夹)
    • 秒传文件
    • 批量重命名/移动/复制文件(夹)
    • 批量收藏/取消收藏文件(夹)
    • 批量移动文件到回收站
    • 批量恢复回收站文件
    • 获取回收站文件列表
    • 搜索文件/标签
    • 创建官方分享,支持设置密码,有效期
    • 更新分享(官方)
    • 批量取消分享(官方)
    • 批量保存他人分享文件
    • 自定义分享,突破官方限制
    • 自定义分享保存
    • 支持自定义功能
    • 福利码兑换接口

    一般说来, 能用官方客户端实现的基本操作, 你都可以用 aligo 试试. 无常用功能? 反馈

用法示例

from aligo import *

ali = Aligo()
  1. 如果是第一次使用, 则会弹出二维码, 使用移动端 阿里云盘 扫描授权后即可. 在Windows中默认调用图片查看器打开二维码, ;类Unix中, 直接打印到终端.
  2. 如果已经登录过, 则会直接加载保存的配置文件, 如果过期, 则自动刷新, 如果 refresh_token 过期, 则重新弹出二维码供扫描登录

1. 获取文件(列表)

# 所有参数可选, 默认 获取网盘根目录文件列表, 即 parent_file_id='root'
root_list = ali.get_file_list()
# 等价于 root_list = ali.get_file_list(parent_file_id='root')

# 获取指定目录列表
file_list = ali.get_file_list(parent_file_id='')

# 获取指定文件
file = ali.get_file('')

# 通过路径获取文件, 默认以 网盘根目录为基础目录
all_folder = '61076daaa84228b3b3f643a6a32829c30a23785f'
file = ali.get_file_by_path('aligo/All_Test', parent_file_id='root')
assert file.file_id == all_folder

image-20210801220111374

  • 阿里云盘和百度不同, 百度网盘使用的是 路径 方式定位文件, 而阿里云盘使用的是 drive_id / share_id + file_id 定位文件
  • aligo 中, 所有默认 drive_id 都可省略, 所以一般只需提供 file_id 参数即可
  • 以前阿里云盘时允许同名文件的, 但现在已更改了此策略, 文件名区分大小写

2. 保存他人分享文件

在阿里云盘分享中, 链接末尾那一段, 代表 share_id, 即代表一个分享的唯一识别码, 例如: https://www.aliyundrive.com/s/nDtTamX9vTP, 此分享密码 share_pwd='w652'

其中 nDtTamX9vTP 即为 share_id

share_id = 'nDtTamX9vTP'
# 如果一个分享是公开分享, 那么 share_pwd = '', 默认就是此值, 所以没有密码时, 直接忽略此参数即可.
# 具体情况你可以在开发工具中查看源码
share_pwd = 'w652'

# 1.如果想获取 此 share_id 对应分享信息, 可以这样做
info = ali.get_share_info(share_id)

# 2.现在你想访问 此分享, 首先你需要获取 share_token
share_token = ali.get_share_token(share_id, share_pwd)

# 3.现在你可以获取分享文件列表了
share_file_list = ali.get_share_file_list(share_id, share_token.share_token)

# 4.这里还有一个 get_share_file 方法
file = ali.get_share_file(share_id, file_id=share_file_list[0].file_id, share_token=share_token.share_token)

# 5.现在我们可以进行保存了, 比如我们保存到网盘根目录, 此时 to_parent_file_id 可以省略
save_file = ali.share_file_saveto_drive(share_id, file_id=share_file_list[0].file_id, share_token=share_token.share_token, to_parent_file_id='root')

# 6.批量保存
batch_save_file = ali.batch_share_file_saveto_drive(share_id, [i.file_id for i in share_file_list], share_token.share_token, 'root')

3. 重名文件

new_file = ali.rename_file('新名字.jpg', '', check_name_mode='refuse', drive_id=ali.default_drive_id)

4. 移动文件

# 移动默认 drive_id 下的 file_id 文件到 默认 drive_id 的 'root' 下
move_file = ali.move_file('', 'root')

# 批量可使用 batch_move_files 方法

# 复制文件
# ali.copy_file()
# ali.batch_copy_files()

5. 移动文件到回收站

trash_file = ali.move_file_to_trash('')

# 批量 batch_move_to_trash

6. 获取回收站文件列表

recyclebin_list = ali.get_recyclebin_list()

7. 从回收站恢复文件

restore_file = ali.restore_file('')

# 批量 batch_restore_files

8. 收藏/取消收藏

ali.starred_file('', starred=True)

# starred=True 表示收藏
# starred=False 表示取消收藏

# 获取收藏列表, 具体参数用法, 请查看 代码提示 或 源码
starred_list = ali.ali.get_starred_list()

9. 秒传文件

image-20210809201550879

# 具体参数看源码
# 必须参数, 取个name, 随意

# content_hash, size 这两个就是唯一确定一个文件的参数, 即秒传所需参数
ali.create_by_hash(...)

10. 下载文件(夹)

image-20210809194334643

11. 上传文件(夹)

image-20210809194425009

12. 分享文件, 可设置密码, 有效期

image-20210809194503800

13. 自定义分享, 突破官方限制

image-20210809194553492

# 这里以 share_folder_by_aligo 为例
x = ali.share_folder_by_aligo('')

# 返回值是一个字符串 aligo://... 

14. 保存自定义分享

image-20210809194944720

# ali.save_files_by_aligo(), 这个方法需要提供一个类似: aligo://... 的字符串数据 

15. 搜索文件

image-20210809195122391

# ali.search_file()
# 官方搜索功能提供非常多的选项, 如果全部列出来, 那这个函数太难看了, 我把常用参数列举出来了, 其他的用 **kwargs, 但这种没有代码提示, 所以提供了 body 参数, 它是一个相应的请求体对象. 其他存在 **kwargs 的方法也是一样的.
  • 使用body参数

    image-20210809195526616

16. 搜索目标/标签

这个功能用于搜索图片视频标签, 所谓标签就是阿里通过图像视频识别技术, 自动为其打上的标签, 比如 你能通过 风景 关键字, 搜索云盘中与风景相关的照片. 同时它可能也会包含搜索名字, 或近似含义的标签.

image-20210809195853232

示例:

image-20210809200947811

通过这张图, 使用 create_by_hash 方法, 就可以获得一张壁纸 ?? 图中所示文件

x = ali.create_by_hash('壁纸.jpg', content_hash='<图中有>', size='<图中有>')

# 注意: size 参数应该是 int 类型, 虽然给 str 也是没有问题的, 但是 Pycharm 可能会黄色警告🤣

17. 福利码兑换

ali.rewards_space('今天要开心哦')

自定义功能

这里以删除文件为例, 自定义功能

其他例子我想不出来了, 因为基本上都实现了

') ">
"""..."""
from aligo import Aligo


class CustomAligo(Aligo):
    """自定义 aligo """

    V2_FILE_DELETE = '/v2/file/delete'

    def delete_file(self, file_id: str):
        """删除文件"""
        response = self._post(self.V2_FILE_DELETE, body={'file_id': file_id})
        return response.json()


cali = CustomAligo()

cali.delete_file('')

FAQ

  1. 为什么代码中注释这么少(没有)

    因为模块太多了, 同时也是没必要的, apis接口简单, 稍许使用, 便可完全掌握, 所以我也就偷个懒了.

    如果有问题可以随时 反馈

  2. 有(彻底)删除文件(夹)的功能吗?

    没有, 因为太过危险, 但是有移动文件(夹)到回收站的功能. 如果万一要实现的话, 请参考自定义功能

  3. 可以操作保险箱中的文件吗?

    不可以, 非必要, 也不安全

  4. 为什么获取文件列表(10000个)这么慢?

    这是没办法的事情, 官方限制最多一次性获取 200 个, 10000 个的话, 要发几十个请求, 并且还不能并发或者批量, 因为后一个请求依赖前一个请求的内容.

  5. 没有你想要的功能?

    请尽管 反馈, 如果提议不错, 我会好好考虑的. 如果不能附加进去, 我也会回复, 给一些建议或替代方案.

  6. 你这文档也太简单了吧?

    是很简单, 后续慢慢完善. 这个花了我不少心思, 也拖了好久, 今天赶鸭子上架. 🦆 🦆 🦆

  7. BUG在所难免

    如果 出现BUG使用问题, 或 不合逻辑的设计, 或者 建议, 请 issue

aligo反馈交流群

Comments
  • BUG: Package requests share_token not converted to str

    BUG: Package requests share_token not converted to str

    操作系统信息 Linux localhost 5.10.107-android13-4-00004-gf0fe4f768061-ab8935229 on Termux

    错误描述 With python 11, share_token in the POST header is not converted to type str and thus cause a type error.

    opened by JingMatrix 15
  • 下载文件夹时有发生错误

    下载文件夹时有发生错误

    操作系统信息

    debian 11

    python 3.9.2

    依赖包版本

    Package           Version
    ----------------- --------------
    aligo             2.1.1
    arrow             1.2.2
    certifi           2020.6.20
    chardet           4.0.0
    coloredlogs       15.0.1
    httplib2          0.18.1
    humanfriendly     10.0
    idna              2.10
    Pillow            9.0.1
    pip               20.3.4
    pycurl            7.43.0.6
    PySimpleSOAP      1.16.2
    python-apt        2.2.1
    python-dateutil   2.8.2
    python-debian     0.1.39
    python-debianbts  3.1.0
    PyYAML            6.0
    qrcode            7.3.1
    qrcode-terminal   0.8
    reportbug         7.10.3+deb11u1
    requests          2.25.1
    setuptools        52.0.0
    six               1.16.0
    tqdm              4.62.3
    typing-extensions 4.1.1
    urllib3           1.26.5
    wheel             0.34.2
    

    错误描述

    Traceback (most recent call last):
      File "/usr/local/lib/python3.9/dist-packages/aligo/core/Download.py", line 123, in download_files
        file_path = self._core_download_file(file_path, file.download_url)
      File "/usr/local/lib/python3.9/dist-packages/aligo/core/Download.py", line 86, in _core_download_file
        with requests.get(url, headers={
      File "/usr/lib/python3/dist-packages/requests/api.py", line 76, in get
        return request('get', url, params=params, **kwargs)
      File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
        return session.request(method=method, url=url, **kwargs)
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request
        prep = self.prepare_request(req)
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request
        p.prepare(
      File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare
        self.prepare_url(url, params)
      File "/usr/lib/python3/dist-packages/requests/models.py", line 390, in prepare_url
        raise MissingSchema(error)
    requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.9/dist-packages/aligo/apis/Download.py", line 84, in download_folder
        return self.__download_folder(folder_file_id, local_folder, drive_id)
      File "/usr/local/lib/python3.9/dist-packages/aligo/apis/Download.py", line 93, in __download_folder
        self.__download_folder(folder_file_id=file.file_id,
      File "/usr/local/lib/python3.9/dist-packages/aligo/apis/Download.py", line 93, in __download_folder
        self.__download_folder(folder_file_id=file.file_id,
      File "/usr/local/lib/python3.9/dist-packages/aligo/apis/Download.py", line 93, in __download_folder
        self.__download_folder(folder_file_id=file.file_id,
      File "/usr/local/lib/python3.9/dist-packages/aligo/apis/Download.py", line 97, in __download_folder
        self.download_files(files, local_folder=local_folder)
      File "/usr/local/lib/python3.9/dist-packages/aligo/core/Download.py", line 126, in download_files
        file_path = self._core_download_file(file_path, file.download_url)
      File "/usr/local/lib/python3.9/dist-packages/aligo/core/Download.py", line 86, in _core_download_file
        with requests.get(url, headers={
      File "/usr/lib/python3/dist-packages/requests/api.py", line 76, in get
        return request('get', url, params=params, **kwargs)
      File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
        return session.request(method=method, url=url, **kwargs)
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 528, in request
        prep = self.prepare_request(req)
      File "/usr/lib/python3/dist-packages/requests/sessions.py", line 456, in prepare_request
        p.prepare(
      File "/usr/lib/python3/dist-packages/requests/models.py", line 316, in prepare
        self.prepare_url(url, params)
      File "/usr/lib/python3/dist-packages/requests/models.py", line 390, in prepare_url
        raise MissingSchema(error)
    requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?
    
    opened by Kimiato 15
  • 下载子文件夹失败

    下载子文件夹失败

    操作系统信息 ubuntu python 3.6

    错误描述 通过download_folder, file_id下载子文件夹失败,命令只是创建了文件夹,没有下载文件 部分代码如下:

    file = ali.get_file_by_path('./scannetv2')
    ali.download_folder(file.file_id, local_folder='./traindata')
    
    opened by chendaozai 8
  • 无效下载链接或链接已过期 {resp.url}

    无效下载链接或链接已过期 {resp.url}

    操作系统信息

    The outout of uname -a:

    Linux Matrix.xyz 5.15.0-35-generic #36-Ubuntu SMP Sat May 21 02:24:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
    

    错误描述

    无法直接下载分享文件,即使转存之后也不行。 Traceback:

    Traceback (most recent call last):
      File "/home/jing/Documents/Code/Shell/scripts/aliyun-share", line 77, in <module>
        ali.download_file(download_path, download_url)
      File "/home/jing/.local/lib/python3.10/site-packages/aligo/apis/Download.py", line 160, in download_file
        return self._core_download_file(file_path, url)
      File "/home/jing/.local/lib/python3.10/site-packages/aligo/core/Download.py", line 96, in _core_download_file
        raise ValueError(f'无效下载链接或链接已过期 {resp.url}')
    
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/jing/Documents/Code/Shell/scripts/aliyun-share", line 85, in <module>
        ali.download_file(file_id=file_id, local_folder="/tmp")
      File "/home/jing/.local/lib/python3.10/site-packages/aligo/apis/Download.py", line 160, in download_file
        return self._core_download_file(file_path, url)
      File "/home/jing/.local/lib/python3.10/site-packages/aligo/core/Download.py", line 96, in _core_download_file
        raise ValueError(f'无效下载链接或链接已过期 {resp.url}')
    

    我的代码片段如下:

    download_url = ali.get_share_link_download_url(
        share_id=share_id, share_token=share_token,
        file_id=file_id).download_url
    if download_path == '':
        download_path = '/tmp/' + ali.get_share_file(
            share_id=share_id,
            share_token=share_token.share_token,
            file_id=file_id).name
    try:
        ali.download_file(download_path, download_url)
    except ValueError:
        file_id = ali.share_file_saveto_drive(
            share_id=share_id,
            share_token=share_token,
            file_id=file_id).file_id
        try:
            ali.download_file(file_id=file_id, local_folder="/tmp")
        finally:
            ali.move_file_to_trash(file_id=file_id)
    
    
    opened by JingMatrix 7
  • 同步别人分享的文件到自己网盘中

    同步别人分享的文件到自己网盘中

    新功能请求

    别人分享的文件,检测是否有更新,自动同步到自己的网盘中

    场景:老婆看的电视剧,别人分享的链接是每几天更新一两集,希望实现在分享的链接在更新的时候,能同步到自己的网盘中(去重) 样例链接:https://www.aliyundrive.com/s/V1P1Nh9UW4N/folder/6370e1883f286b59c01549378cf7e4f1ce74ea3f

    opened by jojohoooo 5
  • 好像只能秒传了,之前没这问题

    好像只能秒传了,之前没这问题

    Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn conn = connection.create_connection( File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 96, in create_connection raise err File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection sock.connect(sa) TimeoutError: [Errno 110] Connection timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request self._validate_conn(conn) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn conn.connect() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 353, in connect conn = self._new_conn() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fc314b64b80>: Failed to establish a new connection: [Errno 110] Connection timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 755, in urlopen retries = retries.increment( File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 574, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.aliyundrive.com', port=443): Max retries exceeded with url: /adrive/v3/file/list (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc314b64b80>: Failed to establish a new connection: [Errno 110] Connection timed out'))

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last): File "/root/upload.py", line 6, in remote_folder = ali.get_folder_by_path('download') File "/usr/local/lib/python3.9/dist-packages/aligo/apis/File.py", line 158, in get_folder_by_path folders = self.get_file_list(parent_file_id=parent_file_id, drive_id=drive_id, type='folder') File "/usr/local/lib/python3.9/dist-packages/aligo/apis/File.py", line 97, in get_file_list return list(result) File "/usr/local/lib/python3.9/dist-packages/aligo/core/File.py", line 16, in _core_get_file_list yield from self._list_file(ADRIVE_V3_FILE_LIST, body, GetFileListResponse) File "/usr/local/lib/python3.9/dist-packages/aligo/core/BaseAligo.py", line 161, in _list_file response = self._post(PATH, body=body) File "/usr/local/lib/python3.9/dist-packages/aligo/core/BaseAligo.py", line 93, in _post return self._auth.post(path=path, host=host, body=body, ignore_auth=ignore_auth) File "/usr/local/lib/python3.9/dist-packages/aligo/core/Auth.py", line 350, in post return self.request(method='POST', url=host + path, params=params, File "/usr/local/lib/python3.9/dist-packages/aligo/core/Auth.py", line 300, in request response = self.session.request( File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.aliyundrive.com', port=443): Max retries exceeded with url: /adrive/v3/file/list (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc314b64b80>: Failed to establish a new connection: [Errno 110] Connection timed out'))

    opened by 65654865 5
  • 获取分享下载链接的文件时401

    获取分享下载链接的文件时401

    操作系统信息

    。。。

    错误描述

    提示重试5次,依然401 09:01:32.857 tozy.INFO POST https://api.aliyundrive.com/v2/file/get_share_link_download_url 401 79 09:01:32.952 tozy.INFO POST https://api.aliyundrive.com/v2/share_link/get_share_token 200 590 09:01:33.040 tozy.INFO POST https://api.aliyundrive.com/v2/file/get_share_link_download_url 401 79 09:01:33.135 tozy.INFO POST https://api.aliyundrive.com/v2/share_link/get_share_token 200 590 09:01:33.226 tozy.INFO POST https://api.aliyundrive.com/v2/file/get_share_link_download_url 401 79 09:01:33.320 tozy.INFO POST https://api.aliyundrive.com/v2/share_link/get_share_token 200 590 09:01:33.410 tozy.INFO POST https://api.aliyundrive.com/v2/file/get_share_link_download_url 401 79 09:01:33.511 tozy.INFO POST https://api.aliyundrive.com/v2/share_link/get_share_token 200 590 09:01:33.599 tozy.INFO POST https://api.aliyundrive.com/v2/file/get_share_link_download_url 401 79 09:01:33.699 tozy.INFO POST https://api.aliyundrive.com/v2/share_link/get_share_token 200 590 09:01:33.699 tozy.INFO 重试 5 次仍旧失败 09:01:33.700 tozy.WARNING [method status_code] POST 401 09:01:33.700 tozy.WARNING [url] https://api.aliyundrive.com/v2/file/get_share_link_download_url 09:01:33.701 tozy.WARNING [response body] {"code":"ShareLinkTokenInvalid","message":"ShareLinkToken is invalid. expired"}

    opened by tozy1203 3
  • Add search API

    Add search API

    新功能请求

    Aliyundrive now offer search api, please refer to

    curl 'https://api.aliyundrive.com/recommend/v1/shareLink/search' \
      -H 'authority: api.aliyundrive.com' \
      -H 'pragma: no-cache' \
      -H 'cache-control: no-cache' \
      -H 'accept: application/json, text/plain, */*' \
      -H 'x-canary: client=web,app=share,version=v2.3.1' \
      -H 'x-share-token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kc29uIjoie1wiZG9tYWluX2lkXCI6XCJiajI5XCIsXCJzaGFyZV9pZFwiOlwiZkpXSEVqV1I2aG1cIixcImNyZWF0b3JcIjpcIjIzZDBlZDdjOWYwYjQ5YzdhZGNhY2Q4MjlmYzMzMWNlXCIsXCJ1c2VyX2lkXCI6XCJhbm9ueW1vdXNcIn0iLCJjdXN0b21UeXBlIjoic2hhcmVfbGluayIsImV4cCI6MTY2ODUxNzUyOSwiaWF0IjoxNjY4NTEwMjY5fQ.LxrpwA9Avf8pIiJMvJeTtCfZS6BzoqeMqicdq172pD692DMErqT3XVpssWUs4-HMJllckdyg6AYJwEXpJ0Z93TufWjOXzAn4LicIB-neC9ZZRPoOnCDeNeXDgt3GN7s0NNMpPp3zA79LYlSDkD2_-5BLeXAz7zN6mbToVt-b1Pg' \
      -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/6.3.1 Chrome/94.0.4606.126 Safari/537.36' \
      -H 'content-type: application/json;charset=UTF-8' \
      -H 'dnt: 1' \
      -H 'accept-language: en-US,en;q=0.9' \
      -H 'origin: https://www.aliyundrive.com' \
      -H 'sec-fetch-site: same-site' \
      -H 'sec-fetch-mode: cors' \
      -H 'sec-fetch-dest: empty' \
      -H 'referer: https://www.aliyundrive.com/' \
      --data-raw '{"share_id":"fJWHEjWR6hm","keyword":"地球","limit":20,"order_by":"name DESC"}' \
      --compressed
    

    as an example.

    opened by JingMatrix 3
  • token 获取使用手机版获取

    token 获取使用手机版获取

    新功能请求

    目前版本使用的token为pc版本的token,获取下载链接下载时,需要带上 "Referer": "https://www.aliyundrive.com/" 的header,发现使用手机版本的token不需要,建议使用手机版登陆的token来获取下载链接。

    opened by Kimiato 3
  • 「TypeError: __init__() got an unexpected keyword argument 'domain_id'」错误

    「TypeError: __init__() got an unexpected keyword argument 'domain_id'」错误

    情况描述:

    1. 之前已成功登录过1次,登录信息已被保存至 aligo.json,且登录后所有功能都可正常调用。
    2. 上次成功登录1天后,重新打开 Python,重新使用 ali = Aligo() 创建对象,并尝试调用上传文件接口,出现「TypeError: init() got an unexpected keyword argument 'domain_id'」错误,无法上传。
    3. 上述问题怀疑是登录态没有自动更新导致,遂删除「aligo.json」文件,然后重新使用 auth = Auth() 创建对象,打算重新扫描二维码、重新登录。
    4. 在重新扫描二维码登录后,又出现「TypeError: init() got an unexpected keyword argument 'domain_id'」错误,而 auth 对象并未成功创建,无法使用任何功能。

    附:重新扫描二维码登录后,打印出来的 Log 如下

    23:37:22.128 INFO 等待扫描二维码 ... 23:37:22.129 INFO 已扫描, 等待确认 ... 23:37:24.270 INFO 等待扫描二维码 ... 23:37:24.270 INFO 已确认 (你可以关闭二维码图像了.) Traceback (most recent call last): File "", line 1, in File "/home/han/miniconda3/lib/python3.8/site-packages/aligo/core/Auth.py", line 154, in init self._login() File "/home/han/miniconda3/lib/python3.8/site-packages/aligo/core/Auth.py", line 200, in _login self.token = Token(**response.json()) TypeError: init() got an unexpected keyword argument 'domain_id'

    跪请大佬协助解决问题!

    opened by lhanlhanlhan 3
  • 一些建议

    一些建议

    1.建议将 download_file download_files download_folder upload_file upload_files upload_folder 合并为downloadupload 同时允许直接传递获取的文件/文件夹对象或文件路径 2.建议后台增加一个字典形式的网盘文件目录缓存来减轻压力(可能会比直接遍历快一点?)

    opened by hmm-ctrl 2
  • 文件夹同步时空目录未被创建

    文件夹同步时空目录未被创建

    操作系统信息 Windows 。。。

    错误描述

        ali_core = Aligo(level=logging.DEBUG)  # 第一次使用,会弹出二维码,供扫描登录
        folder_path_alipan = "/SecBox/个人资料"
        folder_path_local = "E:\\SecBox\\个人资料"
        sync_folder = ali_core.get_folder_by_path(folder_path_alipan)
    
        ali_core.sync_folder(folder_path_local, sync_folder.file_id, True, follow_delete=True)
    

    同步时本地和云盘中的文件大小和数量都是正常的, 但云盘中文件夹数量要少于本地的数量, 用winmerge对比后发现缺少的目录都是空目录. 。。。

    opened by dark-origin 1
Releases(v5.5.5)
A bot that connects your guild chat to a Discord channel, written in Python.

Guild Chat Bot A bot that connects your guild chat to a discord channel. Uses discord.py and pyCraft Deploy on Railway Railway is a cloud development

Evernote 10 Sep 25, 2022
CSUL Discord Bot

Cruzeiro This is the same old bot running on the Discord Server of CSUL, but i've changed the code. It's better now. Discord.py Heroku How i did The b

Operaho 6 Jan 31, 2022
radiant discord anti nuke src leaked lol.

radiant-anti-wizz-leaked radiant discord anti nuke src leaked lol, the whole anti sucks but idc. sucks to suck thats tuff bro LMAOOOOOO join my server

ok 15 Aug 06, 2022
Python library for the eWarehousing Solutions API.

eWarehousing Solutions Python Library This library provides convenient access to the eWarehousing Solutions API from applications written in the Pytho

eWarehousing Solutions 2 Nov 09, 2022
Create custom Vanity URLs for Discord without 30 boosts

CustomVanity - Made by udp#6666 aka Apolo - OpenSource Custom Discord Vanity Creator How To Use Open CustomVanity.py Write your server invite code Wri

apolo 17 Aug 23, 2022
Total servers you're in!

Discord-Servercount With this script you can check the amount of servers you are in, along with statistics of how many servers you are owner in and in

Nickyux 1 Feb 12, 2022
This is a Innexia Group Manager Bot with many features

⚡ Innexia ⚡ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... Available on Telegram as @Innexia ❤️ Suppor

TeamDeeCode 84 Jun 04, 2022
Pybt: a BaoTa panel python sdk

About Pybt is a BaoTa panel python sdk. Pybt 是一个宝塔面板API的Python版本sdk封装库。 公司很多服务器都装了宝塔面板,通过宝塔来部署、安装、维护一些服务,服务器的数量上以后,导致了维护的不方便,这个时候就想使用宝塔提供的API来开发一个运维平台

Adam Zhang 9 Dec 05, 2022
Clash of Clans v6.253 private server written in python

cocps Clash of Clans v6.253 private server written in python how2play download server files download Patched APK run Main.py and play Authors Patched

5 Aug 28, 2022
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Ali Hejazizo 12 Aug 14, 2022
Yes, it's true :yellow_heart: This repository has 326 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serverless! If

510 Dec 28, 2022
Discord bot that generates boba drinks. Submission for sunhacks 2021

boba-bot Team Poggies' submission for Sunhacks 2021. Find our project page on Devpost, and a video demonstration can be found on YouTube. Commands $he

Joshua Tenorio 3 Nov 02, 2022
eBay Scraper Homework 3 With Python

eBay Scraper Homework 3 Description of Code My ebay-dl.py file is programmed with python to download 6 key pieces of information - name, if there are

1 Nov 10, 2021
Changes the Telegram bio, profile picture, first and last name to the song that the user is currently listening to.

TGBIOFY - Telegram & Spotify integration Changes the Telegram bio, profile picture, first and last name to the song that the user is currently listeni

elpideus 26 Dec 07, 2022
Popcorn-time-api - Python API for interacting with the Popcorn Time Servers

Popcorn Time API 📝 CONTRIBUTIONS Before doing any contribution read CONTRIBUTIN

Antonio 3 Oct 31, 2022
A python script to extract information from a Microsoft Remote Desktop Web Access (RDWA) application

This python script allow to extract various information from a Microsoft Remote Desktop Web Access (RDWA) application, such as the FQDN of the remote server, the internal AD domain name (from the FQD

Podalirius 60 Dec 09, 2022
Search stock images (e.g. via Unsplash) and save them to your Wagtail image library.

Wagtail Stock Images Search stock images (e.g. via Unsplash) and save them to your Wagtail image library. Requirements Python 3 Django = 2 Wagtail =

Vicktor 12 Oct 12, 2022
🐲 Powerfull Discord Token Stealer made in python

🐲 Follow me here 🐲 Discord | YouTube | Github ☕ Usage 💻 Downloading git clone https://github.com/KanekiWeb/Powerfull-Token-Stealer

Kaneki 61 Dec 19, 2022
The EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy

EscapePod Extension SDK for Python by cyb3rdog This is the EscapePod Python SDK for Cyb3rVector's EscapePod Extension Proxy. With this SDK, you can: m

cyb3rdog 3 Mar 07, 2022
A collection of scripts to steal BTC from Lightning Network enabled custodial services. Only for educational purpose! Share your findings only when design flaws are fixed.

Lightning Network Fee Siphoning Attack LN-fee-siphoning is a collection of scripts to subtract BTC from Lightning Network enabled custodial services b

Reckless_Satoshi 14 Oct 15, 2022