0.1.6B bugfix

This commit is contained in:
User
2025-06-17 19:40:41 -04:00
parent 2c730be26f
commit d6110dd6db
8 changed files with 435 additions and 250 deletions

View File

@@ -2,7 +2,7 @@
namespace App\Remote;
use DOMDocument;
use Dom\HTMLDocument;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
@@ -16,7 +16,7 @@ class CopyManga
{
/**
* @var array Caching options
* @var array{caching: bool, cachingTimeout: int} Caching options
* @deprecated
*/
protected array $options = [
@@ -36,8 +36,10 @@ class CopyManga
/**
* @var string Encryption for legacy image fetch
*
* Since 17/Jun/2025, the key is updated dynamically, added function to fetch the key now
*/
protected string $encryptionKey = "xxxmanga.woo.key";
protected string $encryptionKey = "";
/**
* @var bool Use old method to fetch images list
@@ -326,13 +328,23 @@ class CopyManga
$responses = $this->execute($this->legacyBuildUrl("comic/{$comic}/chapter/{$chapter}"), "GET", $userAgent, ttl: 24 * 60 * 60 * 30);
// Get Content Key
$dom = new DOMDocument();
$dom->loadHTML($responses);
$dataNode = $dom->getElementsByTagName("div");
$dom = HTMLDocument::createFromString($responses, LIBXML_NOERROR);
$scriptNodes = $dom->getElementsByTagName('script');
foreach ($scriptNodes as $node) {
if (strpos($node->textContent, 'var jojo') !== false) {
if (preg_match("/var\s+jojo\s*=\s*'([^']+)'/", trim($node->textContent), $matches)) {
$this->encryptionKey = $matches[1];
}
}
}
$dataNodes = $dom->getElementsByTagName("div");
$encryptedData = "";
foreach ($dataNode as $node) {
foreach ($dataNodes as $node) {
if ($node->getAttribute("class") === 'imageData') {
$encryptedData = $node->attributes->item(1)->value;
break;