Skip to main content

用于访问 Youtube API 的 Python SDK

项目描述

YoutubeSDK

用于访问 Youtube API 的 Python SDK。

要求

  • 蟒蛇 3
  • 请求库

$ pip install requests

安装

从 pip 安装

$ pip install youtube-sdk-py

用法

您可以使用 api 密钥进行初始化:

import youtubesdk

youtube = youtubesdk.Connection(api_key='your api key')

以这种格式访问各种方法

# Channel
channel = youtube.get_channel(channel_id='UCp03YiAWc48Ay9Ew4Nu6_UA')

# Video
video = youtube.get_video(video_id='rbfOxR3OiW8')

# Comment Threads
comment_threads = youtube.get_comment_threads(video_id='EkDuCWOHBVU')

# Comments
comments = youtube.get_comments(comment_id='UgwNpeGtLn59UjTrW7N4AaABAg')

# Playlist Items
playlist_items = youtube.get_playlist_items(playlist_id='PL9a4goxNJut0xjwPV4CZlIJUGuOzwrih0')

# Playlists
playlists = youtube.get_playlists(channel_id='UCp03YiAWc48Ay9Ew4Nu6_UA')

# Search
search = youtube.get_search(channel_id='UCp03YiAWc48Ay9Ew4Nu6_UA', query='full stack')

# Quota
api_units = youtube.api_units_calculator(channel_id='UCp03YiAWc48Ay9Ew4Nu6_UA')

# Channel Statistics - This would return data in the below schema
channel_stats = youtube.get_channel_stats(channel_id='UCp03YiAWc48Ay9Ew4Nu6_UA')
{
    'apiUnitsConsumed': api_units,
    'channelInfo': channel_info,
    'detailedVideoStats': {
        'most': {
            'views': most_viewed_video,
            'likes': most_liked_video,
            'dislikes': most_disliked_video,
            'comments': most_comments_video
        },
        'least': {
            'views': least_viewed_video,
            'likes': least_liked_video,
            'dislikes': least_disliked_video,
            'comments': least_comments_video
        }
    }
}

执照

该项目在 MIT 许可下获得许可 - 请参阅LICENSE文件了解详细信息

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

youtube-sdk-py-0.1.0.tar.gz (5.1 kB 查看哈希

已上传 source

内置分布

youtube_sdk_py-0.1.0-py3-none-any.whl (7.0 kB 查看哈希

已上传 py3