javedali99 / audio-to-text-transcription

This repository contains a Python script that allows users to download the audio from a YouTube video, transcribe it into text, detect the language and save the transcription in txt file automatically.
https://www.javedali.net/post/2023-04-audio-to-text/
MIT License
117 stars 18 forks source link

Getting a Bad Request Error: 400 status code #8

Open Yashraj-Gore opened 1 month ago

Yashraj-Gore commented 1 month ago

So, I've cloned the repo, followed the instructions and given the url to the prompt. It throws a 400 bad request error: Here's the stacktrace:

C:\Users\Striknas\AppData\Local\Microsoft\WindowsApps\python3.9.exe C:\Users\Striknas\PycharmProjects\audio-to-text-transcription\youtube_audio_to_text.py 
Enter the YouTube video URL: https://www.youtube.com/shorts/VEYX24bBOWA
Traceback (most recent call last):
  File "C:\Users\Striknas\PycharmProjects\audio-to-text-transcription\youtube_audio_to_text.py", line 35, in <module>
    audio_stream = yt.streams.filter(only_audio=True).first()
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\__main__.py", line 296, in streams
    return StreamQuery(self.fmt_streams)
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\__main__.py", line 176, in fmt_streams
    stream_manifest = extract.apply_descrambler(self.streaming_data)
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\__main__.py", line 160, in streaming_data
    self.bypass_age_gate()
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\__main__.py", line 257, in bypass_age_gate
    innertube_response = innertube.player(self.video_id)
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\innertube.py", line 448, in player
    return self._call_api(endpoint, query, self.base_data)
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\innertube.py", line 390, in _call_api
    response = request._execute_request(
  File "C:\Users\Striknas\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pytube\request.py", line 37, in _execute_request
    return urlopen(request, timeout=timeout)  # nosec
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 523, in open
    response = meth(req, response)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 632, in http_response
    response = self.parent.error(
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 561, in error
    return self._call_chain(*args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 494, in _call_chain
    result = func(*args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\urllib\request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

Process finished with exit code 1

Maybe anyone can share what could be done to fix this? I have checked for latest pytube version as well as tried couple of other urls to see what's going wrong, but to no avail.