gnfalex / YT_yt_dlp_plugin

MIT License
8 stars 0 forks source link

ERROR: module 'yandex' has no attribute 'request_video_translation' #1

Closed spvkgn closed 7 months ago

spvkgn commented 7 months ago

Привет, пытаюсь разобраться в чем причина этой ошибки, пока что не получается. У меня Linux (Ubuntu 22.04), возможно здесь есть какие-то свои особенности?

 ~ $ yt-dlp --verbose --ignore-config --skip-download --use-extractors=YandexTranslate 'https://www.youtube.com/watch?v=78Ok52tMB30'
[debug] Command-line config: ['--verbose', '--ignore-config', '--skip-download', '--use-extractors=YandexTranslate', 'https://www.youtube.com/watch?v=78Ok52tMB30']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.01.28.232706 from yt-dlp/yt-dlp-nightly-builds [41b6cdb41] (pip)
[debug] Python 3.10.6 (CPython x86_64 64bit) - Linux-5.15.0-78-generic-x86_64-with-glibc2.35 (OpenSSL 3.0.2 15 Mar 2022, glibc 2.35)
[debug] exe versions: ffmpeg 6.0 (fdk,setts), ffprobe 6.0, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.11.0, brotli-1.0.9, certifi-2020.06.20, mutagen-1.45.1, pyxattr-0.7.2, requests-2.25.1, secretstorage-3.3.1, sqlite3-3.37.2, urllib3-1.26.5
[debug] Proxy map: {}
[debug] Request Handlers: urllib
[debug] Extractor Plugins: YandexTranslateIE
[debug] Post-Processor Plugins: YandexTranslateAutoAddPP, YandexTranslateMergePP, YandexTranslateSubtitleFixPP
[debug] Plugin directories: ['/home/pavel/.config/yt-dlp/plugins/YandexTranslate/yt_dlp_plugins']
[debug] Loaded 1 extractors
WARNING: The program functionality for this site has been marked as broken, and will probably not work.
[YandexTranslate] Extracting URL: https://www.youtube.com/watch?v=78Ok52tMB30
[youtube] Extracting URL: https://www.youtube.com/watch?v=78Ok52tMB30
[youtube] 78Ok52tMB30: Downloading webpage
[youtube] 78Ok52tMB30: Downloading ios player API JSON
[youtube] 78Ok52tMB30: Downloading android player API JSON
[youtube] 78Ok52tMB30: Downloading m3u8 information
ERROR: module 'yandex' has no attribute 'request_video_translation'
Traceback (most recent call last):
  File "/home/pavel/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1586, in wrapper
    return func(self, *args, **kwargs)
  File "/home/pavel/.local/lib/python3.10/site-packages/yt_dlp/YoutubeDL.py", line 1721, in __extract_info
    ie_result = ie.extract(url)
  File "/home/pavel/.local/lib/python3.10/site-packages/yt_dlp/extractor/common.py", line 718, in extract
    ie_result = self._real_extract(url)
  File "/home/pavel/.config/yt-dlp/plugins/YandexTranslate/yt_dlp_plugins/extractor/yandex_translate.py", line 47, in _real_extract
    vid_tr = yandex.request_video_translation(self, yt_url , video_id)
AttributeError: module 'yandex' has no attribute 'request_video_translation'
gnfalex commented 7 months ago

Добрый день. Пожалуйста в файле /home/pavel/.config/yt-dlp/plugins/YandexTranslate/yt_dlp_plugins/extractor/yandex_translate.py после 3 строки (import yandex) добавьте строки

print ("yandex path", yandex.__file__)
print ("yandex list", dir(yandex))

Что он выведет при запуске? Должен дополнительно в начале вывести строки

yandex path /home/pavel/.config/yt-dlp/plugins/YandexTranslate/yt_dlp_plugins/yandex/yandex.py
yandex list ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', scriptor', '_getSignature', '_workerHost', '_yandexHmacKey', '_yandexUserAgent', 'getUUID', 'hashlib', 'hmac', 'os', 'request_subtitles_translation', 'request_video_translation', 'sys', 'yandex_pb2']

Попробуйте исправить 3 строку на from ..yandex import yandex Что тогда выведет c упомянутыми ранее print?

spvkgn commented 7 months ago

Видимо, не обнаруживает:

yandex path None
yandex list ['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Забыл добавить, что содержимое yt_dlp_plugins/yandex положил здесь ~/.local/lib/python3.10/site-packages/yandex, иначе ошибка ModuleNotFoundError: No module named 'yandex'

Что тогда выведет c упомянутыми ранее print?

Тоже ModuleNotFoundError: No module named 'yandex'

gnfalex commented 7 months ago

Пожалуйста перекачайте и переустановите. Кстати, как именно Вы устанавливали (какой командой/набором команд)?

spvkgn commented 7 months ago

Спасибо, теперь все запускается!

Кстати, как именно Вы устанавливали (какой командой/набором команд)?

Просто склонировал git -C ~/.config/yt-dlp/plugins clone https://github.com/gnfalex/YT_yt_dlp_plugin.git YandexTranslate И установил свежий protobuf python3 -m pip install -U protobuf, т.к. в репах убунты старая версия