qsniyg / maxurl

Finds larger/original versions of images and videos
https://qsniyg.github.io/maxurl/
Apache License 2.0
1.11k stars 69 forks source link

Support bilibilicomics.net #1324

Open qsniyg opened 5 months ago

qsniyg commented 5 months ago

Thanks to anonymous for reporting:

https://www.bilibilicomics.net/episode/6817-the-supreme-wood-nascent-soul

tathastu871 commented 4 months ago

Images are loaded dynamically and directly drawn over tainted canvas, when reading comic. Using todataUrl or toblob fails.

Before any direct url be obtained. Heres a mutation observer approach that worked for me on bilibilicomics

APPROACH 1:

var img = []
    window.onload = function() {
        const observer = new PerformanceObserver((list) => {
            list.getEntries().forEach((entry) => {
                if (entry.initiatorType === 'img') {
                    console.log('Image URL: ', entry.name);
img.push(entry.name)
                }
            });
        });
        observer.observe({ entryTypes: ['resource'] });
    };

Just before the comic pages starts loading if this mutation observer is Executed on domain then it logs every direct image urls. However it may fail to capture some urls maybe they got loaded before observer starts.

APPROACH 2: Scroll comic strip till end and all pages are loaded; Then

// Fetch all resources from the network tab
const resources = window.performance.getEntriesByType('resource');

// Filter out images from the resources
const images = resources.filter(resource => resource.initiatorType === 'img');

// Extract the URLs of images
const imageUrls = images.map(image => image.name);

// Print the URLs of images to console
console.log(imageUrls);

APPROACH 3: (FULLPROOF)

imageArray = JSON.parse(document.querySelector('script#__NUXT_DATA__').textContent).filter(item => {
  if (typeof item === "string" && item.includes("jpg")) {
return true;
  }
  return false;
}).map(function(item) { return "https://static.comicfans.io/" + item;})
tathastu871 commented 4 months ago

@qsniyg