Bug 57088 - Не работает запрос субтитров для видео
Summary: Не работает запрос субтитров для видео
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: python3-module-youtube-transcript-api (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: Stanislav Levin
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-12-02 12:00 MSK by Лавренко Егор Сергеевич
Modified: 2025-12-02 15:24 MSK (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Лавренко Егор Сергеевич 2025-12-02 12:00:25 MSK
Системы:
Alt Workstation 11.1 x86-64
Alt Workstation K 11.1.1 x86-64 (Обновлено до Sisyphus)
Alt Education 11.0 XFCE x86-64 
Alt Education 11.0 KDE x86-64
Alt Server 11.0 x86-64

Версия пакета: 
python3-module-youtube-transcript-api-1.0.3-alt2

Описание ошибки: 
При попытке выполнить запрос субтитров для видео на Youtube, возникает ошибка: 
xml.parsers.expat.ExpatError: no element found: line 1, column 0

Примечание:
Для запроса субтитров используется ID видео, например, для видео https://www.youtube.com/watch?v=12345, ID это 12345

Шаги воспроизведения:
1. Установить пакет:
   # apt-get install -y python3-module-youtube-transcript-api
2. Выполнить запрос субтитров для видео:
   $ python3 -c " 
from youtube_transcript_api import YouTubeTranscriptApi
ytt_api = YouTubeTranscriptApi()
ytt_api.fetch('dQw4w9WgXcQ')
"

Ожидаемый результат:
Возвращен объект FetchedTranscript с субтитрами

Реальный результат:
Traceback (most recent call last):
  File "/usr/lib64/python3.12/xml/etree/ElementTree.py", line 1713, in close
    self.parser.Parse(b"", True) # end of data
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
xml.parsers.expat.ExpatError: no element found: line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/usr/lib/python3/site-packages/youtube_transcript_api/_api.py", line 81, in fetch
    .fetch(preserve_formatting=preserve_formatting)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/site-packages/youtube_transcript_api/_transcripts.py", line 134, in fetch
    snippets = _TranscriptParser(preserve_formatting=preserve_formatting).parse(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/site-packages/youtube_transcript_api/_transcripts.py", line 474, in parse
    for xml_element in ElementTree.fromstring(raw_data)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/site-packages/defusedxml/common.py", line 127, in fromstring
    return parser.close()
           ^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/xml/etree/ElementTree.py", line 1715, in close
    self._raiseerror(v)
  File "/usr/lib64/python3.12/xml/etree/ElementTree.py", line 1615, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Дополнительно:
1. Воспроизводится в P11
2. Ошибка воспроизводится для любого видео
3. Ошибка описана в апстриме https://github.com/jdepoix/youtube-transcript-api/issues/320#issuecomment-2949786786 и была исправлена в v1.1.0
Comment 1 Repository Robot 2025-12-02 15:24:02 MSK
python3-module-youtube-transcript-api-1.2.3-alt1 -> sisyphus:

Tue Dec 02 2025 Stanislav Levin <slev@altlinux> 1.2.3-alt1
- 1.0.3 -> 1.2.3 (closes: #57088).