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

Nico Seiga support #56

Closed
0xh3LL0 opened this issue Sep 20, 2019 · 9 comments
Closed

Nico Seiga support #56

0xh3LL0 opened this issue Sep 20, 2019 · 9 comments

Comments

@0xh3LL0
Copy link

0xh3LL0 commented Sep 20, 2019

No description provided.

@AlexAplin
Copy link
Owner

Nico Seiga links? A few downloaders I know support individual images and comics. I'm not sure if any support manga. Take a look at these. I'm not against adding support but if someone else has solved it then I'd like to prevent duplicate work.

@AlexAplin AlexAplin changed the title will you support niconico manga? Nico Seiga support Sep 20, 2019
@0xh3LL0
Copy link
Author

0xh3LL0 commented Sep 21, 2019

how about this:
http://seiga.nicovideo.jp/watch/mg173049

and actually i've tried this:
https://github.com/taba256/nicoseiga-download
but it didnt work since it didnt updated anymore

btw, only unofficial & fanmade manga can be downloaded.

@AlexAplin
Copy link
Owner

AlexAplin commented Sep 21, 2019

Are you sure it doesn't work? I only tested it in Firefox (68.0) with Tampermonkey (4.9.5941) but I got it to work with both official (DRM protected) and fan manga. Example links:

In any case, I think it'd be useful to have Seiga support for batch downloading, including for individual images. I'll be working on support for this if you can't get it to work, so please wait warmly!

@AlexAplin
Copy link
Owner

AlexAplin commented Sep 21, 2019

Official manga use a light form of DRM, decryption is controlled by ImageLoader in http://seiga.nicovideo.jp/js/manga/common.min.js. The data-original attribute in img.lazyload classes contains a binary encrypted form of each image which then gets decrypted into a Base64 string. Other manga can be retrieved without modification from the attribute URL.

var o = this.getKeyFromUrl(e);
t.open('GET', e, !0),
t.responseType = 'arraybuffer',
t.onload = function (t) {
var i = new Uint8Array(this.response);
'' !== o && (i = r.decrypt(i, o));
var s = r.getDataType(i),
l = r.toBase64String(i),
u = 'data:image/' + s + ';base64,' + l;
this.getKeyFromUrl = function (t) {
   var e = t.match('/image/([a-z0-9_]+)/');
   if (null === e) return '';
   var r = e[1].split('_'), n = r[0];
   return n
},
this.decrypt = function (t, e) {
   var r, n = [], a = 8;
   for (r = 0; r < a; r++) n.push(parseInt(e.substr(2 * r, 2), 16));
   for (r = 0; r < t.length; r++) t[r] = t[r] ^ n[r % a];
   return t
},
this.toBase64String = function (t) {
   var e, r = '', n = t.length;
   for (e = 0; e < n; e++) r += String.fromCharCode(t[e]);
   return Base64.btoa(r)
},
this.getDataType = function (t) {
   var e = null, r = t.length;
   return 255 === t[0] && 216 === t[1] && 255 === t[r - 2] && 217 === t[r - 1] ? e = 'jpg' : 137 === t[0] && 80 === t[1] && 78 === t[2] && 71 === t[3] ? e = 'png' : 71 === t[0] && 73 === t[1] && 70 === t[2] && 56 === t[3] && (e = 'gif'), e
}

@AlexAplin
Copy link
Owner

Seiga images can be retrieved at http://seiga.nicovideo.jp/image/source/<image_id> which redirects to a page using the full image.

@0xh3LL0
Copy link
Author

0xh3LL0 commented Sep 21, 2019

hm... thats odd,
i'm using firefox 69 with many settings (to disable telemetry, etc) maybe i'll reset my browser and try again.

@0xh3LL0
Copy link
Author

0xh3LL0 commented Sep 21, 2019

confirmed, it works...

@0xh3LL0
Copy link
Author

0xh3LL0 commented Sep 23, 2019

I think it'd be useful to have Seiga support for batch downloading

yes please!
it would be usefull to download 1 page manga with many chapters like this one
http://seiga.nicovideo.jp/comic/36993

@AlexAplin
Copy link
Owner

AlexAplin commented Oct 6, 2019

You can now download individual chapters, full manga, and images. I'll be working on support for downloading everything from a user/uploader.

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

No branches or pull requests

2 participants