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

manga.bilibili.com download failed #397

Open
Silverbullet069 opened this issue Dec 18, 2024 · 7 comments
Open

manga.bilibili.com download failed #397

Silverbullet069 opened this issue Dec 18, 2024 · 7 comments

Comments

@Silverbullet069
Copy link

Silverbullet069 commented Dec 18, 2024

I'm using comiccrawler CLI to download Zombie World from Bilibili Manga, but it's not working. It seems that the website has changed API JSON structure again.

C:\windows>comiccrawler download https://manga.bilibili.com/detail/mc26536?from
=manga_person
Start analyzing https://manga.bilibili.com/detail/mc26536?from=manga_person
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Scripts\comi
ccrawler.exe\__main__.py", line 7, in <module>
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Lib\site-pac
kages\comiccrawler\cli.py", line 61, in console_init
    console_download(arguments["<url>"], arguments["--dest"])
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Lib\site-pac
kages\comiccrawler\cli.py", line 40, in console_download
    Analyzer(mission).analyze()
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Lib\site-pac
kages\comiccrawler\analyzer.py", line 58, in analyze
    self.do_analyze()
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Lib\site-pac
kages\comiccrawler\analyzer.py", line 84, in do_analyze
    self.mission.title = self.mission.module.get_title(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\users\steamuser\AppData\Local\Programs\Python\Python311\Lib\site-pac
kages\comiccrawler\mods\bilibili_manga.py", line 95, in get_title
    return comic_detail[id]["data"]["title"]
           ~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'data'
@eight04
Copy link
Owner

eight04 commented Dec 18, 2024

The API requires an m1 parameter now.

Zeal-L/BiliBili-Manga-Downloader#176

@eight04
Copy link
Owner

eight04 commented Dec 18, 2024

Seems we have to generate a key and the server would encrypt the image:

            ["getM1AndKey"](_0x2a96d6) {
              var _0x123095 = this;
              0x0;
              return _0xc09916.A(_0x11ef6c().mark(function _0x55753d() {
                var _0x44900d;
                var _0x49d410;
                var _0x2b3e9e;
                var _0x40a9ef;
                var _0x2104be;
                var _0x11b686;
                return _0x11ef6c().wrap(function (_0x2bd092) {
                  for (;;) {
                    switch (_0x2bd092.prev = _0x2bd092.next) {
                      case 0x0:
                        _0x2bd092.next = 0x2;
                        return _0x123095.generateECDHKeyPair();
                      case 0x2:
                        _0x44900d = _0x2bd092.sent;
                        _0x2bd092.next = 0x5;
                        return window.crypto.subtle.exportKey("raw", _0x44900d.publicKey);
                      case 0x5:
                        _0x49d410 = _0x2bd092.sent;
                        _0x2bd092.next = 0x8;
                        return window.crypto.subtle.exportKey('jwk', _0x44900d.privateKey);
                      case 0x8:
                        _0x2b3e9e = _0x2bd092.sent;
                        _0x40a9ef = JSON.stringify(_0x2b3e9e);
                        _0x2104be = btoa(_0x40a9ef);
                        _0x11b686 = btoa(String.fromCharCode.apply(null, new Uint8Array(_0x49d410)));
                        _0x123095._m1Info.push({
                          'm1': _0x2104be,
                          'key': _0x11b686,
                          'url': _0x2a96d6
                        });
                        return _0x2bd092.abrupt("return", _0x11b686);
                      case 0xe:
                      case "end":
                        return _0x2bd092.stop();
                    }
                  }
                }, _0x55753d);
              }))();
            }

@Silverbullet069
Copy link
Author

Hmm what could be this generateECDHKeyPair()? It came from which npm library?

@eight04
Copy link
Owner

eight04 commented Dec 23, 2024

            ["generateECDHKeyPair"]() {
              0x0;
              return _0xc09916.A(_0x11ef6c().mark(function _0x41183f() {
                return _0x11ef6c().wrap(function (_0x3b4abf) {
                  for (;;) {
                    switch (_0x3b4abf.prev = _0x3b4abf.next) {
                      case 0x0:
                        var _0x19fb77 = {
                          "name": "ECDH",
                          "namedCurve": 'P-256'
                        };
                        _0x3b4abf.next = 0x2;
                        return window.crypto.subtle.generateKey(_0x19fb77, true, ['deriveKey', 'deriveBits']);
                      case 0x2:
                        return _0x3b4abf.abrupt("return", _0x3b4abf.sent);
                      case 0x3:
                      case "end":
                        return _0x3b4abf.stop();
                    }
                  }
                }, _0x41183f);
              }))();
            }

@Silverbullet069
Copy link
Author

@eight04 Can you teach me how to do reverse engineer on these JS file?

@eight04
Copy link
Owner

eight04 commented Jan 18, 2025

I just tried some deobfuscator randomly from google.
https://obf-io.deobfuscate.io/

You can also try AI, they are extremely good at this field since they had learnt bunch of them.

@Silverbullet069
Copy link
Author

I just tried some deobfuscator randomly from google. https://obf-io.deobfuscate.io/

Yep, this tool is god-sent gift. I have used it to deal with colamanga just recently.

You can also try AI, they are extremely good at this field since they had learnt bunch of them.

I have GitHub Copilot Pro but I didn't use them on deobfuscating. I will start using more often now.

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

2 participants