Giter Site home page Giter Site logo

Comments (6)

bingsanyu avatar bingsanyu commented on June 11, 2024 1

感谢你提出的问题。你的说法是对的。

这个取模操作是在调试中忘记删除的代码。在 飞书API文档 中,checksum的示例值是一个20位的数字,当时看的时候百思不得其解,试了几种方法均不知其所以然,遂恢复原始代码,跑通后忘记删除此处的取模。

再次感谢你的反馈。

祝好

from feishu_minutes.

bingsanyu avatar bingsanyu commented on June 11, 2024 1

URL的差异是因为飞书文档中使用的API是公共API,需要通过自建应用获取token。而本项目使用的是内部API。

这要从鉴权方式说起。不过你可以简单理解为:

  • 自建应用是一个管家,它拿到钥匙后有权限进行各种操作。
  • 而本项目使用的cookie则是你的替身,由他来代替你进行各种操作。

为了简化使用流程,本项目选择使用cookie而非自建应用,因此不能直接使用文档中的API,而是抓取网络请求(包括请求行、请求头、请求体、响应体等),然后在代码中复现请求流程

具体而言,一个上传过程中的网络请求有(图中使用的是F12开发者工具):
image
image
image

诚然两种API在使用上有些许不同,但殊途同归,可以相互参考之。

如有语焉不详之处,欢迎继续交流。

from feishu_minutes.

jcfangc avatar jcfangc commented on June 11, 2024 1

感谢你的解答!我大开眼界!

另外我修改了一小段代码,表达更加简洁一点,是feishu_downloader.pyFeishuDownloader.check_minutes的代码:

        # 如果只下载会议妙记,则过滤掉自己上传的妙记
        if download_type == 0:
            need_download_minutes = [
                minutes
                for minutes in need_download_minutes
                if minutes["object_type"] == 0
            ]
        # 如果只下载自己上传的妙记,则过滤掉会议妙记
        elif download_type == 1:
            need_download_minutes = [
                minutes
                for minutes in need_download_minutes
                if minutes["object_type"] == 1
            ]

修改为:

        # 过滤需要下载的妙记,基于download_type确定是会议妙记还是自己上传的妙记
        need_download_minutes = [
            minutes
            for minutes in need_download_minutes
            if minutes["object_type"] == download_type
        ]

希望采纳~

from feishu_minutes.

bingsanyu avatar bingsanyu commented on June 11, 2024 1

已修改,感谢贡献!另外minutes["object_type"]的取值只有0和1,而download_type可能为2,因此需要加一条判断。

from feishu_minutes.

bingsanyu avatar bingsanyu commented on June 11, 2024 1

👋 两个相关的飞书API文档 分片上传文件(上传分片)上传文件 今日已修改checksum的示例值。
image
image

修改后:
image

感谢你的贡献 🥳!

from feishu_minutes.

jcfangc avatar jcfangc commented on June 11, 2024

谢谢你,你好有礼貌。

我还有想要请教你的,想请你教教我:
image
image

这是我在你提供的文档链接看到的内容,我发现你的请求体和cURL好像都和文档有些偏差,以下是你的请求体:

        json = {
            "upload_id": self.upload_id,
            "num_blocks": (self.file_size + self.block_size - 1) // self.block_size,
            "vhid": self.vhid,
            "risk_detection_extra": '{"source_terminal":1,"file_operate_usage":3,"locale":"zh_cn"}',
        }

以下是你的cRUL:

        complete_url1 = (
            f"https://internal-api-space.feishu.cn/space/api/box/upload/finish/"
        )

此外,还有一个请求,这次的cURL和文档也不一致,请求体依旧不同,我就不分开引用了:

        complete_url2 = f"https://meetings.feishu.cn/minutes/api/upload/finish"
        json = {
            "auto_transcribe": True,
            "language": "mixed",
            "num_blocks": (self.file_size + self.block_size - 1) // self.block_size,
            "upload_id": self.upload_id,
            "vhid": self.vhid,
            "upload_token": self.upload_token,
            "object_token": self.object_token,
        }

我想知道怎么查找这些信息,和文档的差异是因为文档更新导致的吗?

希望得到你的回复,谢谢。

from feishu_minutes.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.