ImSejin / lezhin-comics-downloader

📥 Downloader for lezhin comics
https://www.lezhin.com
Apache License 2.0
58 stars 4 forks source link

issue with images #201

Open MEYILLI opened 1 year ago

MEYILLI commented 1 year ago

https://ibb.co/hgg5FR0

Is there anyway to fix how the images are downloaded?

ImSejin commented 1 year ago

Let me know the command you ran.

Is there still problem when you download again?

MEYILLI commented 1 year ago

I tried: java -jar lezhin-comics-downloader-3.1.0.jar -l=ko -n=placebo -j java -jar lezhin-comics-downloader-3.1.0.jar -l=ko -n=placebo But it downloads this messed up images

ImSejin commented 1 year ago

Try to do with option -s.

MEYILLI commented 1 year ago

-s didn't fix the problem.

ImSejin commented 1 year ago

For me.

References

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

diomirox commented 10 months ago

This is a tricky puzzle I'm working on. I've tried to figure it out, but it's still elusive.

Here's the scenario: I found something on this manga chapter link: https://www.lezhinus.com/en/comic/bjalex_en/01.

Firstly, you need to split the image into a 5 by 5 matrix:

var matrix = [
  [11, 21, 31, 41, 51],
  [12, 22, 32, 42, 52],
  [13, 23, 33, 43, 53],
  [14, 24, 34, 44, 54],
  [15, 25, 35, 45, 55]
];

Consider this as the representation of a secret image.

var matrix = [
  [15, 51, 31, 44, 52],
  [22, 13, 53, 55, 23],
  [33, 41, 32, 35, 43],
  [34, 24, 42, 21, 45],
  [11, 12, 25, 14, 54]
];

This is a correctly placed image. It works for this chapter, but it might not work in another chapter. There could be some key or information inside the initial chapter response that determines the correct placement. If I find something, I'll share it.

diomirox commented 10 months ago

I've finally cracked it! It turns out, it's simpler than I thought. They use the chapter ID as the seed. I initially attempted a Matrix vision approach, but that was a mistake. The solution lies in straightforward XOR and shift operations. The chapter ID is the key to cracking it – that's the essence of the algorithm.

class G {
  constructor(value) {
    this.value = typeof value === 'bigint' ? value : BigInt(value);
  }

  xor(other) {
    return new G(this.value ^ other.value);
  }

  shiftRight(bits) {
    return new G(this.value >> bits);
  }

  shiftLeft(bits) {
    return new G(this.value << bits);
  }

  and(mask) {
    return new G(this.value & mask);
  }

  remainder(divisor) {
    return new G(this.value % divisor);
  }
}

function Se(t) {
  return BigInt(t);
}

function seedReader(e) {
  e = (e = (e = e.xor(e.shiftRight(Se(12)))).xor(e.shiftLeft(Se(25)).and(Se("18446744073709551615")))).xor(e.shiftRight(Se(27)));
  const state = e.and(Se("18446744073709551615"));
  const place = e.shiftRight(Se(32)).remainder(Se(25));

  return [place.value, state];
}

const decodeID = (id) => {
  let i = 0;
  let arrays = Array.from({ length: 25 }, () => i++);

  let gstate = new G(id);
  for (let i = 0; i < 25; i++) {
    const [place, state] = seedReader(gstate);
    const u = arrays[i];
    arrays[i] = arrays[place];
    arrays[place] = u;
    gstate = state;
  }

  return arrays;
}

The G class provides essential operations for bitwise manipulation, forming the backbone of the algorithm. The seedReader function then uses these operations to generate a shuffled array of indices based on the chapter ID seed.

Arekkusu1998 commented 9 months ago

Sorry if I'm bothering you @diomirox. In the issue #238 you wrote me that:

You might want to give it a try as well. It's running smoothly on my computer. I downloaded some images and successfully decoded them using Node.js XD. If you're interested, you can check out the decoding strategy I used ...

Since @ImSejin seems too busy to fix the problem at the moment and I've many chapters with mixed images, I would kindly ask if you could teach me -in the most intuitive way possible- how to use your decoding strategy. I can download Node.js, but Idk how to proceed from there on.

diomirox commented 9 months ago

Hey @Arekkusu1998, I've got some exciting news for you! I'm currently working on a manga downloader that will allow you to easily download content from Lezhinus. I'm aiming to create it as quickly as possible. Stay tuned for updates!

https://github.com/diomirox/mdownload

Arekkusu1998 commented 9 months ago

Stay tuned for updates!

Yup, for sure!

stale[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.