Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ok.ru] Download subtitle #5744

Closed
8 of 9 tasks
mazznoer opened this issue Dec 7, 2022 · 2 comments · Fixed by #5920
Closed
8 of 9 tasks

[ok.ru] Download subtitle #5744

mazznoer opened this issue Dec 7, 2022 · 2 comments · Fixed by #5920
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-enhancement Feature request for some website

Comments

@mazznoer
Copy link

mazznoer commented Dec 7, 2022

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

  • I understand that I will be blocked if I remove or skip any mandatory* field

Checklist

  • I'm requesting a site-specific feature
  • I've verified that I'm running yt-dlp version 2022.11.11 (update instructions) or later (specify commit)
  • I've checked that all provided URLs are playable in a browser with the same IP and same login details
  • I've searched the bugtracker for similar issues including closed ones. DO NOT post duplicates
  • I've read the guidelines for opening an issue
  • I've read about sharing account credentials and I'm willing to share it if required

Region

No response

Example URLs

https://ok.ru/video/4249587550747

Provide a description that is worded well enough to be understood

Download subtitle from ok.ru

Provide verbose output that clearly demonstrates the problem

  • Run your yt-dlp command with -vU flag added (yt-dlp -vU <your command line>)
  • Copy the WHOLE output (starting with [debug] Command-line config) and insert it below

Complete Verbose Output

[debug] Command-line config: ['https://ok.ru/video/4249587550747', '--no-download', '--list-subs', '-vU']
[debug] User config "/home/nir/.config/yt-dlp/config": ['--no-overwrites', '--restrict-filenames', '--merge-output-format', 'mkv', '--paths', '~/Downloads/youtube_dl', '--output', '%(title)s_%(id)s_%(autonumber)d.%(ext)s']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.11.11 [8b644025b] (source)
[debug] Lazy loading extractors is disabled
[debug] Plugins: ['SamplePluginIE', 'SamplePluginPP']
[debug] Git HEAD: 935bac1e
[debug] Python 3.8.10 (CPython x86_64 64bit) - Linux-5.15.0-56-generic-x86_64-with-glibc2.29 (OpenSSL 1.1.1f  31 Mar 2020, glibc 2.31)
[debug] exe versions: ffmpeg 4.2.7, ffprobe 4.2.7
[debug] Optional libraries: certifi-2019.11.28, secretstorage-2.3.1, sqlite3-2.6.0
[debug] Proxy map: {}
[debug] Loaded 1731 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.11.11, Current version: 2022.11.11
yt-dlp is up to date (2022.11.11)
[Odnoklassniki] Extracting URL: https://ok.ru/video/4249587550747
[Odnoklassniki] 4249587550747: Downloading desktop webpage
[Odnoklassniki] 4249587550747: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
4249587550747 has no subtitles
@mazznoer mazznoer added site-enhancement Feature request for some website triage Untriaged issue labels Dec 7, 2022
@bashonly
Copy link
Member

bashonly commented Dec 8, 2022

This works:

diff --git a/yt_dlp/extractor/odnoklassniki.py b/yt_dlp/extractor/odnoklassniki.py
index 4f325f087..679535635 100644
--- a/yt_dlp/extractor/odnoklassniki.py
+++ b/yt_dlp/extractor/odnoklassniki.py
@@ -11,6 +11,7 @@
     int_or_none,
     qualities,
     smuggle_url,
+    traverse_obj,
     unescapeHTML,
     unified_strdate,
     unsmuggle_url,
@@ -294,6 +295,18 @@ def _extract_desktop(self, url):
 
         like_count = int_or_none(metadata.get('likeCount'))
 
+        subtitles = {}
+        for sub in traverse_obj(metadata, ('movie', 'subtitleTracks', ...), expected_type=dict):
+            sub_url = sub.get('url')
+            if not sub_url:
+                continue
+            if sub_url.startswith('//'):
+                sub_url = f'https:{sub_url}'
+            subtitles.setdefault(sub.get('language') or 'en', []).append({
+                'url': sub_url,
+                'ext': 'vtt',
+            })
+
         info = {
             'id': video_id,
             'title': title,
@@ -305,6 +318,7 @@ def _extract_desktop(self, url):
             'like_count': like_count,
             'age_limit': age_limit,
             'start_time': start_time,
+            'subtitles': subtitles,
         }
 
         # pladform

@bashonly bashonly added patch-available There is patch available that should fix this issue. Someone needs to make a PR with it and removed triage Untriaged issue labels Dec 8, 2022
bashonly added a commit that referenced this issue Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-available There is patch available that should fix this issue. Someone needs to make a PR with it site-enhancement Feature request for some website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants