youtube.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:Zoom2Youtube 作者: Welltory 项目源码 文件源码
def upload_from_dir(self, video_dir: str):
        assert os.path.isdir(video_dir), "Not found directory"
        files = self._get_files_from_dir(video_dir, 'mp4')
        for fname in files:
            fpath = os.path.join(video_dir, fname)
            if not os.path.exists(fpath):
                continue
            title = os.path.splitext(os.path.basename(fname))[0]
            options = dict(
                file=fpath,
                title=title,
                privacyStatus='unlisted',
            )
            video_id = self.upload_video(options)
            if not video_id:
                continue

            video_url = 'https://www.youtube.com/watch?v={}'.format(video_id)
            print('File uploaded: {}'.format(video_url))
            message = '{} - {}'.format(title, video_url)
            self.notify(message)
            os.remove(fpath)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号