如何使用Python,JavaScript或API获取YouTube频道的电子邮件

发布于 2025-01-28 18:25:49 字数 197 浏览 3 评论 0原文

YouTube是否提供了使用OAuth获取频道电子邮件的任何API?

或者,如何使用Python刮擦提供有关提供的图像中有关部分的电子邮件。

youtube电子邮件

Does Youtube provides any API to get channel emails using Oauth?

Or How can I get the email in About Section in the provided image using scraping with Python.

About section Youtube email

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亢潮 2025-02-04 18:25:49

如果使用 channels.list.list.list.list.list.list 方法。 剪辑

借助如下

# -*- coding: utf-8 -*-

# Sample Python code for youtube.channels.list
# See instructions for running these code samples locally:
# https://developers.google.com/explorer-help/code-samples#python

import os

import google_auth_oauthlib.flow
import googleapiclient.discovery
import googleapiclient.errors

scopes = ["https://www.googleapis.com/auth/youtube.readonly"]

def main():
    # Disable OAuthlib's HTTPS verification when running locally.
    # *DO NOT* leave this option enabled in production.
    os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

    api_service_name = "youtube"
    api_version = "v3"
    client_secrets_file = "YOUR_CLIENT_SECRET_FILE.json"

    # Get credentials and create an API client
    flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
        client_secrets_file, scopes)
    credentials = flow.run_console()
    youtube = googleapiclient.discovery.build(
        api_service_name, api_version, credentials=credentials)

    request = youtube.channels().list(
        part="snippet",
        id="CHANNELID"
)
    response = request.execute()

    print(response)

if __name__ == "__main__":
    main()

,您可以在结果中查看通道的描述。如果该频道的所有者包含了那里的电子邮件地址,则会看到它。描述显示在频道的大约选项卡中

Going though the YouTube api if you use the channels.list method. with the snippit

As follows

# -*- coding: utf-8 -*-

# Sample Python code for youtube.channels.list
# See instructions for running these code samples locally:
# https://developers.google.com/explorer-help/code-samples#python

import os

import google_auth_oauthlib.flow
import googleapiclient.discovery
import googleapiclient.errors

scopes = ["https://www.googleapis.com/auth/youtube.readonly"]

def main():
    # Disable OAuthlib's HTTPS verification when running locally.
    # *DO NOT* leave this option enabled in production.
    os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

    api_service_name = "youtube"
    api_version = "v3"
    client_secrets_file = "YOUR_CLIENT_SECRET_FILE.json"

    # Get credentials and create an API client
    flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
        client_secrets_file, scopes)
    credentials = flow.run_console()
    youtube = googleapiclient.discovery.build(
        api_service_name, api_version, credentials=credentials)

    request = youtube.channels().list(
        part="snippet",
        id="CHANNELID"
)
    response = request.execute()

    print(response)

if __name__ == "__main__":
    main()

You can then see the description of the channel in the results. If the owner of the channel included the email address there then you will see it. The description is shown in the about tab of the channel

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文