Google 클라우드 플랫폼을 사용하여 Youtube에서 비디오 전사를 가져옵니다.

그래서 요전에 어떤 비디오의 대본을 제공하는 파이썬 코드를 검색하던 중 인터넷에서 검색한 모든 작업을 수행했지만 불행했습니다. 하지만 우리는 프로그래머가 가장 잘하는 일을 인터넷에서 더 많이 검색합니다. 드디어 내가 원하는 코드를 얻었습니다. 모두 덕분에
프라그나칼프 기술연구소
. 코드가 내 예상과 조금 다르지만 일부 필터를 적용하여 YouTube 비디오의 스크립트를 볼 수 있도록 만들었습니다.
우리 과정에 몇 가지 단계가 포함되어 있으니 기다려 주세요!!


# pip install google-api-python-client
# pip install youtube_transcript_api

from apiclient.discovery import build
from youtube_transcript_api import YouTubeTranscriptApi

api_key = "Secret Key"  # replace it with your API key
video_id = str(input("Enter the video id: "))  # replace it with your channel id
youtube = build('youtube', 'v3',developerKey=api_key)

try:
        responses = YouTubeTranscriptApi.get_transcript(
            video_id, languages=['en'])
        print('\n'+"Video: "+"https://www.youtube.com/watch?v=" +
              str(video_id)+'\n'+'\n'+"Captions:")
        for response in responses:
            text = response['text']
            print(text)
except Exception as e:
        print(e)

# pip install google-api-python-client
# pip install youtube_transcript_api

from apiclient.discovery import build
from youtube_transcript_api import YouTubeTranscriptApi

api_key = "Secret Key"  # replace it with your API key
video_id = str(input("Enter the video id: "))  # replace it with your channel id
youtube = build('youtube', 'v3',developerKey=api_key)

try:
        responses = YouTubeTranscriptApi.get_transcript(
            video_id, languages=['en'])
        print('\n'+"Video: "+"https://www.youtube.com/watch?v=" +
              str(video_id)+'\n'+'\n'+"Captions:")
        for response in responses:
            text = response['text']
            print(text)
except Exception as e:
        print(e)

# pip install google-api-python-client
# pip install youtube_transcript_api

from apiclient.discovery import build
from youtube_transcript_api import YouTubeTranscriptApi

api_key = "Secret Key"  # replace it with your API key
video_id = str(input("Enter the video id: "))  # replace it with your channel id
youtube = build('youtube', 'v3',developerKey=api_key)

try:
        responses = YouTubeTranscriptApi.get_transcript(
            video_id, languages=['en'])
        print('\n'+"Video: "+"https://www.youtube.com/watch?v=" +
              str(video_id)+'\n'+'\n'+"Captions:")
        for response in responses:
            text = response['text']
            print(text)
except Exception as e:
        print(e)



API 키와 그 모든 것을 얻는 방법에 대한 전체 자습서는 이에 대한 제 중간 기사를 확인할 수 있습니다. 👇👇👇



솔직히 말해서 dev 플랫폼에서 코드와 구문 강조 표시 및 이미지 삽입을 작성하는 것이 약간 어렵다는 것을 알지만 코드가 그다지 매력적으로 보이지 않을 수 있지만 YouTube의 모든 비디오에서는 잘 작동합니다.

또한 내 트위터에서 나를 팔로우할 수 있습니다.

좋은 웹페이지 즐겨찾기