qsniyg / maxurl

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

there are 3 different 'eroticbeauties.net' rules and they take forever. #1234

Closed vscum closed 10 months ago

vscum commented 10 months ago

the images take forever to load and sometimes stall out completely... these are some examples of galleries with no nudity https://www.eroticbeauties.net/pics/cute-redhead-sabrina-lynn-lifts-her-skirt-and-teases-72693.html https://www.eroticbeauties.net/pics/foxy-redhead-spencer-bisson-teases-outdoors-and-flashes-her-juicy-ass-69767.html

and some galleries like these only load 5 of the images for no apparent reason (nsfw). https://www.eroticbeauties.net/pics/anna-l-in-mini-bikini-by-hegre-art-281093.html

here are all the conflicting rules. this shit is too complex for me.

        if (domain_nowww === "eroticbeauties.net" ||
            domain === "blog.pinkworld.com") {
            var eb_info = {
                regex: /^[a-z]+:\/\/[^/]+\/+pics\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/,
                qfi: "https://" + domain + "/pics/-${id}.html",
                image_regex: /<a class='pswp_open' href='(https?:\/\/[^/]+\/+(?:[^"']+\/+)?content\/[^'"]+\/full\/[^'"]+)'/,
                video_regex: /(<video id="fluidPlayer">[\s\S]+<\/video>)/
            };
            var pw_info = {
                regex: /^[a-z]+:\/\/[^/]+\/+[^/]*-([0-9]+)\.html(?:[?#].*)?$/,
                qfi: "https://" + domain + "/-${id}.html",
                image_regex: /<figure\s+class='gallery-thumb[^"']*'>\s*<a\s+(?:[^>]+\s+)?href='(https?:\/\/[^/]+\/+(?:[^"']+\/+)?content\/[^'"]+\/full\/[^'"]+)'/,
                video_regex: /(<video id="pinkworld_video"[\s\S]+<\/video>)/
            };
            var our_info = domain_nosub === "eroticbeauties.net" ? eb_info : pw_info;
            newsrc = website_query({
                // eb.net only
                website_regex: our_info.regex,
                query_for_id: our_info.qfi,
                override_cb: function(cb, data) {
                    var id = "1";
                    var imu_id = src.match(/#imu-id=(.*)/);
                    if (imu_id)
                        id = imu_id[1];
                    common_functions["update_album_info_links"](data, function(x) {
                        var x_id = x.replace(/.*\/(?:[^/?#.]+_)?([0-9]+\.)[a-z0-9]{3,4}(?:[?#].*)?$/i, "$1");
                        return x_id === id;
                    });
                    cb(data);
                },
                process: function(done, resp, cache_key) {
                    var matches = match_all(resp.responseText, our_info.image_regex);
                    if (!matches) {
                        console_error(cache_key, "Unable to find match for", resp);
                        return done(null, false);
                    }
                    var images = [];
                    var video_match = resp.responseText.match(our_info.video_regex);
                    if (video_match) {
                        var videosources = common_functions["get_videotag_sources"](video_match[1]);
                        if (videosources && videosources.video.length) {
                            for (var _i = 0, _a = videosources.video; _i < _a.length; _i++) {
                                var video = _a[_i];
                                images.push({
                                    url: video.url,
                                    headers: {
                                        Referer: "https://" + domain + "/"
                                    },
                                    video: true,
                                    is_current: false
                                });
                                // since this is an album, we only want the largest video
                                break;
                            }
                        }
                    }
                    for (var i_5 = 0; i_5 < matches.length; i_5++) {
                        images.push({
                            url: decode_entities(matches[i_5][1]),
                            is_current: i_5 === 0
                        });
                    }
                    return done({
                        url: images[0].url,
                        album_info: {
                            type: "links",
                            links: images
                        },
                        is_private: true
                    }, 200); // pinkworld = 255 seconds?
                }
            });
            if (newsrc)
                return newsrc;
        }
        if ((host_domain_nowww === "eroticbeauties.net" ||
            host_domain === "blog.pinkworld.com") && options.element) {
            var fullimg = null;
            newsrc = common_functions["get_pagelink_host_el_matching"](options, {
                url_match: /^[a-z]+:\/\/[^/]+\/+(?:pics\/+)?[^/]*-[0-9]+\.html(?:[?#].*)?$/,
                el_match: function(x) {
                    if ((x.tagName !== "IMG" || !x.classList.contains("img-responsive")) &&
                        (x.tagName !== "SOURCE" && (!x.parentElement || x.parentElement.tagName !== "PICTURE")))
                        return false;
                    var current = x;
                    while (current = current.parentElement) {
                        if (current.tagName === "FIGURE" ||
                            (current.tagName === "A" && current.classList.contains("pswp_open"))) {
                            var alink = current;
                            if (current.tagName !== "A")
                                alink = current.querySelector("a");
                            fullimg = alink.href;
                            return true;
                        }
                    }
                    return false;
                }
            });
            if (newsrc) {
                var urls = [];
                urls.push({
                    url: options.host_url.replace(/[?#].*/, "") + "#imu-id=" + src.replace(/.*\/(?:[^/?#.]+_)?([0-9]+\.)[a-z0-9]{3,4}(?:[?#].*)?$/i, "$1"),
                    is_pagelink: true
                });
                if (fullimg)
                    urls.push(fullimg);
                if (urls.length)
                    return urls;
            }
        }
        if (domain_nosub === "eroticbeauties.net" ||
            // http://cdn.hometownnudes.com/content/atk-galleria-ashley-stone-253374/auto/5/tn@1x/01.jpg
            //   http://cdn.hometownnudes.com/content/atk-galleria-ashley-stone-253374/full/01.jpg
            domain_nosub === "hometownnudes.com" ||
            // thanks to vscum on github for reporting: https://github.com/qsniyg/maxurl/issues/1166
            // https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/auto/7/main/01.webp
            //   https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/auto/7/main/01.jpg
            //   https://cdn.eroticmetart.com/content/metart_ba45b9ea1e5d6/full/01.jpg
            domain_nosub === "eroticmetart.com"
        // http://media.pinkworld.com/cms/content/povd_20151221130919_alex-grey-picnic-in-the-park/tn@1x/02.jpg
        //   http://media.pinkworld.com/cms/content/povd_20151221130919_alex-grey-picnic-in-the-park/full/02.jpg
        // http://media.pinkworld.com/cms/content/ftvgirls_20150908142022_alexia-a-fresh-nudist/1024/01.jpg
        //   http://media.pinkworld.com/cms/content/ftvgirls_20150908142022_alexia-a-fresh-nudist/full/01.jpg
        //domain_nosub === "pinkworld.com"
        ) {
            // https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/auto/3/tn@1x/04.jpg
            //   https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/full/04.jpg
            //   https://cdn.eroticbeauties.net/content/digital-desire-bree-daniels-11136-1/full/test_04.jpg
            // thanks to vscum on github: https://github.com/qsniyg/maxurl/pull/1147/files
            // https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/auto/3/tn@2x/01.webp
            //   https://cdn.eroticbeauties.net/content/metart_20160107202957_blake-bartelli-mointa-by-charles-lightfoot/full/01.jpg
            var baseobj_3 = {
                headers: {
                    Referer: "http://" + domain_nosub + "/"
                },
                referer_ok: {
                    same_domain_nosub: true
                }
            };
            newsrc = src.replace(/\.webp([?#].*)?$/, ".jpg$1");
            if (newsrc !== src) {
                baseobj_3.url = newsrc;
                return baseobj_3;
            }
            newsrc = src.replace(/(\/content\/+[^/]*\/+)(?:[^/]*\/+[^/]*\/+)?(?:tn@[^/]*|[0-9]+|main)\/+((?:[^/.]+_)?[0-9]+\.[^/.]*)$/, "$1full/$2");
            if (newsrc !== src) {
                baseobj_3.url = newsrc;
                return baseobj_3;
            }
        }
vscum commented 10 months ago

my changes from https://github.com/qsniyg/maxurl/pull/1147/files work and solve both these issues, though i would replace domain_nowww with just domain

qsniyg commented 10 months ago

The 5 images issue should be fixed now, thanks for reporting. As to why it's so slow, it loads the image gallery first. When it stalls, can you share the console output?