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

Add Subtitle Decoder #14

Closed
uu7157 opened this issue Nov 30, 2023 · 11 comments
Closed

Add Subtitle Decoder #14

uu7157 opened this issue Nov 30, 2023 · 11 comments

Comments

@uu7157
Copy link

uu7157 commented Nov 30, 2023

Some shows have encoded subtitles, which is similar to - I think - HiTv encoding https://sepr0.com/posts/encrypted-subtitles-gohitv/
Sample URL of encoded subtitles:
https://kisskh.co/Drama/Seasons-of-Blossom?id=6082

@prateek45
Copy link

facing the same issue. please resolve

@debakarr
Copy link
Owner

debakarr commented Dec 3, 2023

Yep I know this one. But I don't know how it is encoded. Any idea how it was encoded?

@gogetta69
Copy link

Yep I know this one. But I don't know how it is encoded. Any idea how it was encoded?

ENCRYPTION ALGORITHM: AES 128 CBC
INITIALIZATION VECTOR: 6852612370185273
DECRYPTION KEY: 8056483646328763

@debakarr
Copy link
Owner

debakarr commented Dec 21, 2023

#15 #18 Should work.

@debakarr
Copy link
Owner

debakarr commented Dec 21, 2023

New version is released (v0.1.7) which should fix this.

Without decryption:

$ kisskh dl https://kisskh.co/Drama/Night-Has-Come?id=8357 -f 1 -l 1 -o . 
2023-12-21 07:06:47,616 - INFO - Getting details for Episode 1...
[generic] Extracting URL: https://hls05.videodelivery.shop/hls05/Night-Has-Come-Ep1/index.m3u8
[generic] index: Downloading webpage
[generic] index: Downloading m3u8 information
[generic] index: Checking m3u8 live status
[info] index: Downloading 1 format(s): 0
[download] ./Night_Has_Come/Night_Has_Come_E01.mp4 has already been downloaded
[download] 100% of  187.75MiB
2023-12-21 07:06:50,121 - INFO - Downloading English sub...

$ head Night_Has_Come/Night_Has_Come_E01.en.txt 
1
00:00:17,230 --> 00:00:20,620
O7/IcKbSiPWvjf9ZDApGz5k1HcFRViOkWZh7ycxseodPloMXNEAvgMCheiFhfXJD

2
00:00:21,380 --> 00:00:24,740
omMKrTrmZ5GZkwgexx6RLsogSJoBF4veRLTSPVLDF3TyXC+CcXXeQR/Pu21iQLC+

3
00:00:34,920 --> 00:00:39,410

With decryption:

$ export KISSKH_KEY=8056483646328763
$ export KISSKH_INITIALIZATION_VECTOR=6852612370185273

$ kisskh dl https://kisskh.co/Drama/Night-Has-Come?id=8357 -f 1 -l 1 -o . -ds
2023-12-21 07:05:33,476 - INFO - Getting details for Episode 1...
[generic] Extracting URL: https://hls05.videodelivery.shop/hls05/Night-Has-Come-Ep1/index.m3u8
[generic] index: Downloading webpage
[generic] index: Downloading m3u8 information
[generic] index: Checking m3u8 live status
[info] index: Downloading 1 format(s): 0
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 223
[download] Destination: ./Night_Has_Come/Night_Has_Come_E01.mp4
[download] 100% of  187.75MiB in 00:00:07 at 24.86MiB/s
WARNING: index: Possible MPEG-TS in MP4 container or malformed AAC timestamps. Install ffmpeg to fix this automatically
2023-12-21 07:05:43,009 - INFO - Downloading English sub...

$ head Night_Has_Come/Night_Has_Come_E01.en.txt 
1
00:00:17,230 --> 00:00:20,620
(Lee Jae In / Kim Woo Seok / Choi Ye Bin)

2
00:00:21,380 --> 00:00:24,740
(Cha Woo Min / Ahn Ji Ho / Jeong So Ri)

3
00:00:34,920 --> 00:00:39,410

Not hardcoding the IV and key as they may change in future.

@callista13
Copy link

it is not working for me

(base) C:\Users\CC>set KISSKH_KEY="8056483646328763"

(base) C:\Users\CC>set KISSKH_INITIALIZATION_VECTOR="6852612370185273"

(base) C:\Users\CC>kisskh dl "https://kisskh.co/Drama/My-Boss?id=8273" -f 3 -l 8 -o . -ds
2024-01-06 15:50:12,687 - INFO - Getting details for Episode 3...
[generic] Extracting URL: https://cachemp4.site/My-Boss.Ep3.mp4?v=1
[generic] My-Boss.Ep3: Downloading webpage
[info] My-Boss.Ep3: Downloading 1 format(s): mp4
[download] Destination: My_Boss\My_Boss_E03.mp4
[download] 100% of  420.13MiB in 00:00:04 at 87.76MiB/s
2024-01-06 15:50:18,860 - INFO - Downloading English sub...
Traceback (most recent call last):
  File "C:\Users\CC\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\CC\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\CC\anaconda3\Scripts\kisskh.exe\__main__.py", line 7, in <module>
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\cli.py", line 132, in dl
    downloader.download_subtitles(subtitles, filepath, decrypter)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\downloader.py", line 54, in download_subtitles
    decrypted_subtitle = decrypter.decrypt_subtitles(output_path)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\decrypt_subtitle.py", line 14, in decrypt_subtitles
    decrypted_text = self.cipher.decrypt(sub.text)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\aes_cipher.py", line 17, in decrypt
    cipher = self.__get_cipher()
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\aes_cipher.py", line 14, in __get_cipher
    return Cipher(algorithms.AES(self.key), modes.CBC(self.initialization_vector), backend=default_backend())
  File "C:\Users\CC\anaconda3\lib\site-packages\cryptography\hazmat\primitives\ciphers\algorithms.py", line 35, in __init__
    self.key = _verify_key_size(self, key)
  File "C:\Users\CC\anaconda3\lib\site-packages\cryptography\hazmat\primitives\ciphers\algorithms.py", line 20, in _verify_key_size
    raise ValueError(
ValueError: Invalid key size (144) for AES.

@debakarr
Copy link
Owner

debakarr commented Jan 7, 2024

it is not working for me

(base) C:\Users\CC>set KISSKH_KEY="8056483646328763"

(base) C:\Users\CC>set KISSKH_INITIALIZATION_VECTOR="6852612370185273"

(base) C:\Users\CC>kisskh dl "https://kisskh.co/Drama/My-Boss?id=8273" -f 3 -l 8 -o . -ds
2024-01-06 15:50:12,687 - INFO - Getting details for Episode 3...
[generic] Extracting URL: https://cachemp4.site/My-Boss.Ep3.mp4?v=1
[generic] My-Boss.Ep3: Downloading webpage
[info] My-Boss.Ep3: Downloading 1 format(s): mp4
[download] Destination: My_Boss\My_Boss_E03.mp4
[download] 100% of  420.13MiB in 00:00:04 at 87.76MiB/s
2024-01-06 15:50:18,860 - INFO - Downloading English sub...
Traceback (most recent call last):
  File "C:\Users\CC\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\CC\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\CC\anaconda3\Scripts\kisskh.exe\__main__.py", line 7, in <module>
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\CC\anaconda3\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\cli.py", line 132, in dl
    downloader.download_subtitles(subtitles, filepath, decrypter)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\downloader.py", line 54, in download_subtitles
    decrypted_subtitle = decrypter.decrypt_subtitles(output_path)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\decrypt_subtitle.py", line 14, in decrypt_subtitles
    decrypted_text = self.cipher.decrypt(sub.text)
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\aes_cipher.py", line 17, in decrypt
    cipher = self.__get_cipher()
  File "C:\Users\CC\anaconda3\lib\site-packages\kisskh_downloader\helper\aes_cipher.py", line 14, in __get_cipher
    return Cipher(algorithms.AES(self.key), modes.CBC(self.initialization_vector), backend=default_backend())
  File "C:\Users\CC\anaconda3\lib\site-packages\cryptography\hazmat\primitives\ciphers\algorithms.py", line 35, in __init__
    self.key = _verify_key_size(self, key)
  File "C:\Users\CC\anaconda3\lib\site-packages\cryptography\hazmat\primitives\ciphers\algorithms.py", line 20, in _verify_key_size
    raise ValueError(
ValueError: Invalid key size (144) for AES.

You don't need decrypter for that series:

$ kisskh dl "https://kisskh.co/Drama/My-Boss?id=8273" -f 3 -l 8 -o .
2024-01-07 01:02:36,276 - INFO - Getting details for Episode 3...
[generic] Extracting URL: https://cachemp4.site/My-Boss.Ep3.mp4?v=12
[generic] My-Boss.Ep3: Downloading webpage
[info] My-Boss.Ep3: Downloading 1 format(s): mp4
[download] Destination: ./My_Boss/My_Boss_E03.mp4
[download] 100% of  416.24MiB in 00:00:02 at 176.38MiB/s
2024-01-07 01:02:39,958 - INFO - Downloading English sub...
2024-01-07 01:02:40,236 - INFO - Getting details for Episode 4...
[generic] Extracting URL: https://cachemp4.site/My-Boss.Ep4.mp4?v=1
[generic] My-Boss.Ep4: Downloading webpage
[info] My-Boss.Ep4: Downloading 1 format(s): mp4
[download] Destination: ./My_Boss/My_Boss_E04.mp4
[download] 100.0% of  400.65MiB at  251.97MiB/s ETA 00:00^C
Aborted!

$ head -20 My_Boss/My_Boss_E03.en.srt 
1
00:01:35,653 --> 00:01:38,802
(My Boss)

2
00:01:39,210 --> 00:01:41,937
(Episode 3)

3
00:01:42,018 --> 00:01:44,842
(Is it because of Cheng Yao that I fell asleep?)

4
00:02:00,043 --> 00:02:01,575
Cheng Yao, wake up.

5
00:02:03,748 --> 00:02:04,748
Wake up.

@debakarr debakarr closed this as completed Jan 7, 2024
@prateek45
Copy link

There are a lot of series and it's hard to check which episodes require decryption. Is it possible to automatically trigger download if decryption fails? Or something to check if the downloaded file requires decryption or not and automatically downloads accordingly?

@callista13
Copy link

Sorry, it seems as new episodes are out, they decrypted the subtitle of the old episode. Eg. for ep 9 https://kisskh.co/Drama/My-Boss/Episode-9?id=8273&ep=144285&page=0&pageSize=100 I'm getting ValueError: Invalid key size (144) for AES.

@AdzeB
Copy link

AdzeB commented Jan 14, 2024

@debakarr You now need a key for My Boss Ep 16

@PurushothMathav
Copy link

use below method that works for me,

set ALGORITHM=AES 128 CBC
set KISSKH_KEY=8056483646328763
set KISSKH_INITIALIZATION_VECTOR=6852612370185273

after use

kisskh dl "https://kisskh.co/Drama/The-Rise-of-Ning/Episode-5?id=9174&ep=165215&page=0&pageSize=100" -o . -ds

this will help you decrypt subtitle. but downloaded fill will be text file. so, you have to save that file as .srt. then all set. try this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants