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

Support bilibilicomics.net #1324

Open
qsniyg opened this issue May 10, 2024 · 2 comments
Open

Support bilibilicomics.net #1324

qsniyg opened this issue May 10, 2024 · 2 comments

Comments

@qsniyg
Copy link
Owner

qsniyg commented May 10, 2024

Thanks to anonymous for reporting:

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

@tathastu871
Copy link

tathastu871 commented May 17, 2024

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
Copy link

@qsniyg

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