Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[提问]上传视频遇到问题 AttributeError: 'NoneType' object has no attribute '__dict__'. Did you mean: '__dir__'? #698

Closed
RickyCui010 opened this issue Mar 1, 2024 · 8 comments
Labels
bug 漏洞 solved 已解决

Comments

@RickyCui010
Copy link

Python 版本: 3.10

模块版本: 16.2.0

运行环境: Windows


按照文档给的案例上传视频,credential和视频封面,视频文件都修改了,但是遇见这个问题
AttributeError: 'NoneType' object has no attribute 'dict'. Did you mean: 'dir'?

@RickyCui010 RickyCui010 added the question 这啥呀这是,我不到啊 label Mar 1, 2024
@z0z0r4
Copy link
Collaborator

z0z0r4 commented Mar 1, 2024

发下代码

@RickyCui010
Copy link
Author

发下代码

from bilibili_api import sync, video_uploader, Credential

SESSDATA = ".........................."
BILI_JCT =  ".........................."
BUVID3 =  ".........................."

async def main():
    credential = Credential(sessdata=SESSDATA, bili_jct=BILI_JCT, buvid3=BUVID3)

    vu_meta = video_uploader.VideoMeta(tid=130,
                                       title='title',
                                       tags=['音乐综合', '音乐'],
                                       desc='',
                                       cover="cover.png",
                                       no_reprint=True
                                      )
    page = video_uploader.VideoUploaderPage(
        path = 'video.mp4',
        title = '标题',
        description='简介',
    )
    uploader = video_uploader.VideoUploader([page], vu_meta, credential, line=video_uploader.Lines.QN) # 选择七牛线路,不选则自动测速选择最优线路


    @uploader.on("__ALL__")
    async def ev(data):
        print(data)

    await uploader.start()


sync(main())

@Nemo2011
Copy link
Owner

Nemo2011 commented Mar 4, 2024

"porder": self.porder.__dict__(),

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Mar 5, 2024

不清楚但好像是我的锅.jpg 但我在校没法改

@RickyCui010
Copy link
Author

不清楚但好像是我的锅.jpg 但我在校没法改

那哪个版本可以运行呢

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Mar 7, 2024

你不用 meta,直接传json大概就能吧

@RickyCui010
Copy link
Author

RickyCui010 commented Mar 10, 2024

ok了,现在可以了,修改video_uploader.py,原来的 "porder": self.porder.dict(), 这一行删除

class VideoMeta:
    # ... 其他代码 ...

    def __dict__(self) -> dict:
        meta = {
            # ... 其他属性 ...
            #原来的 "porder": self.porder.__dict__(), 这一行删除
        }
        # 确保 porder 不是 None
        if self.porder is not None:
            meta["porder"] = self.porder.__dict__()

        # ... 其他代码 ...
        return meta

@z0z0r4
Copy link
Collaborator

z0z0r4 commented Mar 11, 2024

0272d9c

valkjsaaa added a commit to valkjsaaa/bilibili-api that referenced this issue Mar 11, 2024
valkjsaaa added a commit to valkjsaaa/bilibili-api that referenced this issue Mar 11, 2024
@z0z0r4 z0z0r4 added bug 漏洞 solved 已解决 and removed question 这啥呀这是,我不到啊 labels Mar 15, 2024
@z0z0r4 z0z0r4 closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 漏洞 solved 已解决
Projects
None yet
Development

No branches or pull requests

3 participants