PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
8.75k stars 5.26k forks source link

[ACTION] Issue with Python Code #7513

Closed gitnoobz closed 1 year ago

gitnoobz commented 1 year ago

I am no programmer. I am trying to pull Youtube video transcript using Python. I asked ChatGPT, and they provide me with this:

'from pytube import YouTube from youtube_transcript_api import YouTubeTranscriptApi

Replace 'XXX' with the actual YouTube video ID

video_id = 'AWUDFge4t-4'

Define the YouTube video URL

video_url = f'https://www.youtube.com/watch?v={video_id}'

try:

Create a YouTube object

yt_video = YouTube(video_url)

# Get the highest resolution stream
stream = yt_video.streams.get_highest_resolution()

# Download the video
video_path = stream.download()

# Get the transcript
transcript = YouTubeTranscriptApi.get_transcript(video_id)

# Print the transcript
for entry in transcript:
    print(f"{entry['start']} - {entry['start'] + entry['duration']}: {entry['text']}")

except Exception as e: print(f"An error occurred: {e}") `

Changed the video id but then this came up

An error occurred: AWUDFge4t-4 is age restricted, and can't be accessed without logging in.

The video should not have been age restricted, its a video titled "Become an intellectual explorer: Master the art of conversation | Emily Chamlee-Wright | Big Think"

please help

dylburger commented 1 year ago

Hi @gitnoobz , thanks for reaching out. The error you're seeing:

An error occurred: AWUDFge4t-4 is age restricted, and can't be accessed without logging in.

isn't an error with Pipedream. You should ask this on a pytube forum or somewhere with experts in the YouTube API. Based on the error, it looks like you need to authenticate your YouTube account when using pytube — someone who works with that tool can better assist you.