Skip to content

Enter with your visitorData: An error has occurred: EOF when reading a line #292

Description

@TSxSAHIL

❗ DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE ❗

lack of information will lead to closure of the issue


Describe the bug
A clear and concise description of what the bug is.

You can use the tool: https://github.com/YunzheZJU/youtube-po-token-generator, to get the token
Enter with your visitorData: An error has occurred: EOF when reading a line
127.0.0.1 - - [20/Oct/2024:12:36:51 +0000] "POST /transcribe HTTP/1.1" 500 37 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

This is the error which I am getting while deploying a yt audio downloader on render


code that was used that resulted in the bug

from pytubefix import YouTube
from pytubefix.cli import on_progress

class VideoCoPilot:
    def __init__(self, url):
        self.url = url
        self.audio_filename = None

    def url_to_audio(self):
        link = self.url
        start_time = time.time()
        try:
            collection_folder = os.path.join(os.getcwd(), "db")
            if not os.path.exists(collection_folder):
                os.makedirs(collection_folder)
                print(f"Collection folder created: {collection_folder}")
            else:
                print(f"Using existing collection folder: {collection_folder}")

            yt = YouTube(link, on_progress_callback=on_progress)
            print(f"Downloading audio for: {yt.title}")

            ys = yt.streams.get_audio_only()
            self.audio_filename = os.path.join(collection_folder, "audio.mp3")

            ys.download(output_path=collection_folder, filename="audio.mp3")
            print(f"Audio downloaded at: {self.audio_filename}")

            elapsed_time = time.time() - start_time
            print(f"Time taken to download audio: {elapsed_time:.2f} seconds")
            return self.audio_filename

Expected behavior
A clear and concise description of what you expected to happen.

With this code i wanted a audio from a given youtube link


Screenshots
If applicable, add screenshots to help explain your problem.


Desktop (please complete the following information):

  • OS: [Windows]
  • Python Version [3.11.8]
  • Pytubefix Version [7.4.0]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGSomething isn't working

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions