JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
https://pytubefix.readthedocs.io
MIT License
729 stars 101 forks source link

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

Open TSxSAHIL opened 1 month ago

TSxSAHIL commented 1 month ago

:exclamation: DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE :exclamation:

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):


Additional context Add any other context about the problem here.

Hetari commented 1 month ago

Could you please update Pytubefix to the latest version (Pytubefix 8.1.1) by running the following pip command, and check if the error persists?

pip install --upgrade pytubefix
TSxSAHIL commented 1 month ago

No it does'nt work at all. I am getting the error of "An error has occurred: iE9HMudybyc This request was detected as a bot. Use use_po_token=True to view. See more details at https://github.com/JuanBindez/pytubefix/pull/209"

TSxSAHIL commented 1 month ago

Hi @Hetari I just want a small project which takes a link and return the audio file to it. As I am learning python and i want to deploy it on render

Hetari commented 4 weeks ago

Hi @Hetari I just want a small project which takes a link and return the audio file to it. As I am learning python and i want to deploy it on render

For questions like these, it’s best to start a Discussion rather than an Issue to keep the issues board focused on bugs and feature requests. You can create a discussion under the Discussions tab for more general help or project advice.

In the meantime, I’ve created a small project that meets your requirements. https://gist.github.com/Hetari/168ea013bfa5b26ec7872344eaee283a

In the future, please keep these kinds of questions in Discussions, not Issues.

TSxSAHIL commented 4 weeks ago

Sure @Hetari , It would be great if you can help me out as I am a fresher in this industry I would love to learn from your experience