LImgDLer

Auto-DL

2021-08-31 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name     LImgDLer
// @version  1.5
// @grant    GM_download
// @grant    GM_addStyle
// @include  /^https://(www\.)?(classic\.|Asia|Av|Bade|Behaarte|Bizarr|Busen|Clickandmeet|Deutsche|Devote|Dominante|Erfahrene|Exklusiv|Grosse|Hobby|Junge|Kuss|Latina|Massierende|Molly|Ns|Nymphomane|Orient|Osteuropa|Piercing|Rasierte|Schoko|Tattoo|Ts|Zaertliche|Zierliche)?ladies.de/Sex-Anzeigen//
// @include  https://escorts24.de
// @namespace https://greasyfork.org/users/290665
// @description Auto-DL
// ==/UserScript==
jQuery(function() {
    hideSpam();
    setupMutationObserver();
    var NAME, PHONE;
    if (jQuery('.kuenstlername').length) { // modern mode
        NAME = jQuery('.kuenstlername').first().text();
        PHONE = jQuery('.contacts-data strong').first().text();
    } else if (jQuery('.auftrag-name h3').length) { // themenladies
        NAME = jQuery('.auftrag-name h3').first().text();
        PHONE = jQuery('p.telefon strong').first().text();
    } else if (jQuery('div.full_pad.bigfont strong').length) { // classic
        NAME = jQuery('div.full_pad.bigfont strong').text();
        PHONE = jQuery('.div_td_last.lalign.midfont.itxt_pad.icon_text').eq(1).text();
    }
    PHONE = PHONE.replace(/ \/ /,'-');
    NAME = NAME.replace(/[^\w-\(\) ]/g,'');
    var name = NAME + ' - ' + PHONE
    var phonews = PHONE.replace(/[ \-]+/g,'');
    var SEARCHTERM = `("${NAME}" OR "${PHONE}" OR ${phonews})`;

    var dlArea = jQuery('<div id="LImgDLer">'
                   +'<div class="title"><span class="Llogo">LImgDLer</span> <button id="dlbutton">📥 Download <b>'+name+'</b></button>'
                   +'<button id="lhbutton">🔍 search LH</button></div></div>');

    jQuery('body').on('click', '#lhbutton', function(event) {
        event.stopPropagation();
        event.preventDefault();

        var url = 'https://www.google.de/search?as_sitesearch=lusthaus.cc&q=';
        url += SEARCHTERM;
        window.open(url);
    });

    jQuery(dlArea).find('button').data('name',name);
    jQuery('body').on('click', '#dlbutton', function(event) {
        start(jQuery(event.currentTarget).data('name'));
    });

    if (jQuery('.auftrag-title').length) { // modern mode
        addStyle();
        jQuery('.auftrag-title').first().append(dlArea);
    } else if (jQuery('div#content div.container').length) { // themenladies
        jQuery('div#content div.container').first().append(dlArea);
        addStyle("themen");
    } else if (jQuery('div.sitemenu').length) { // classic
        jQuery('div.sitemenu').append(dlArea);
        addStyle("classic");
    }
    jQuery('#lhbutton').attr('title',SEARCHTERM);

});

function start(name) {
    var downloadlist = [];
    if (jQuery('.rsNav img').length) {
        jQuery('.rsNav img').each(function() {
            var link = jQuery(this).attr('src');
            if (link.match(/-FK\./)) return; // skip videos
            downloadlist.push(link.replace(/(\d+)-F(\d+)\./,'$1-A$2.'));
        });
        jQuery('a.gallery_video').each(function() { // get videos
            if (jQuery(this).data('owg-id')) {
                var id = jQuery(this).data('owg-id').toString();
                var section = id.substr(-3);
                var link =  "https://video1.ladies.de/"+section+"/"+id+"/"+id+"_high.webm";
                downloadlist.push(link.replace(/(\d+)-F(\d+)\./,'$1-A$2.'));
            }
        });
        dlAll(name,downloadlist);
    } else {
        let firstImgURL = jQuery('div#div_foto img').first().attr('src');
        let matches = firstImgURL.match(/(.*)\/([0-9]+)-F1\.JPG$/);
        let URLprefix = matches[1];
        let ID = matches[2];
        if (ID.length) {
            let dataURL = '/includes/lds/data/js/generic/galerie.inc.php?site=galerie&AuftragsID='+ID+'&param1=0';
            jQuery.get(dataURL, function( result ) {
                let arr = result.match(/var +\$anzeige_FotoID *= *\[ *([ 0-9,]+?) *\]/);
                let imgArray = arr[1].split(',');
                imgArray.forEach(function (nr) {
                    let imgURL = `${URLprefix}/${ID}-A${nr}.JPG`;
                    //console.log(imgURL);
                    downloadlist.push(imgURL);
                });
                dlAll(name,downloadlist);
            });
        }
    }
}

function dlAll(path,downloadlist) {
    var dialog = jQuery('<div id="LImgDLerdialog" title="Download to '+path+' ..."></div>').appendTo(jQuery('#LImgDLer'));

    for (let URL of downloadlist) {
        var name = URL.replace(/.*\//,'');
        var file = path.replace(/[^\w-\(\) ]/g,'')+'/'+name;
        URL = URL.replace(/^\/\//,'https://');
        var line = jQuery('<div class="RLDL" data-name="'+name+'">'+name+'</div>\n').appendTo(dialog);

        (function(url,filepath,filename,linediv) {
            var dl = GM_download({
                url: url,
                name: filepath,
                saveAs: false,
                onerror: function(){
                    jQuery(linediv).append('<span class="download_error">ERROR: '+err.error+'<br>'+err.details+'</span>');
                },
                onload: function() {
                    jQuery(linediv).append('<span class="download_ok">✓</span>');
                }
            });
        })(URL,file,name,line);

    }
}

function hideSpam() {
    jQuery('div.anzeige').has('span.webcam-markierung').remove();
    jQuery('div.anzeige').has('div.closed-info').css('opacity','0.3');
    jQuery('section#page-top-sol').remove();
}
function setupMutationObserver() {
    const observer = new MutationObserver(hideSpam);
    let target = jQuery('ul.pagination');
    if (target.length) {
        observer.observe(jQuery(target).get(0), {
            attributes: true,
            childList: true,
            subtree: true
        });
    }
}

function addStyle(mode) {
    let styles = [];
    styles["classic"] = `
#LImgDLer {
    left: 174px;
    top: 109px;
    right: 202px;
    line-height: 10px;
    font-size:9px;
}
.Llogo {
	font-size: 16px;
	top: 2px;
}
#LImgDLer button {
	padding: 4px 12px;
    font-size:11px;
}
button:hover {
    cursor:pointer;
}
    `;
    styles["themen"] = `
div#content div.container {
  position:relative;
}
#LImgDLer {
    left: 16px;
    top: 50px;
    right: 15px;
    line-height: 10px;
}
.Llogo {
	font-size: 17px;
	top: 1px;
}
#LImgDLer button {
	padding: 4px 12px;
}

    `;

    GM_addStyle(`
.download_error {
    color: white;
    background-color: #880010;
    padding: 1px 4px;
    border-radius: 2px;
    margin: 0px 4px;
}

.download_ok {
    color: white;
    background-color: #10a020;
    padding: 1px 4px;
    border-radius: 2px;
    margin: 0px 4px;
}

#LImgDLer {
	max-height: 180px;
	font-size: 10px;
	position: absolute;
	left: 240px;
	top: 0;
	right: 30px;
}
#LImgDLer button {
	background-color: #e28c13;
	border: none;
	margin: 0px 4px;
	padding: 10px 12px;
	line-height: 15px;
	font-size: 15px;
	color: white;
}
#LImgDLer > div.title {
    background-color:#6f789f;
}

#LImgDLerdialog {
    background-color: rgba(255, 255, 255, .52);
    overflow: auto;
    column-width: 110px;
    padding:4px;
}
.Llogo {
	padding: 0 12px;
	color: #e69536;
	font-size: 24px;
	font-weight: 700;
	text-shadow: 0 0 1.5px black;
	font-style: italic;
	top: 3px;
	position: relative;
	line-height: 12px;
}
`);
    if (mode && styles[mode]) {
        GM_addStyle(styles[mode]);
    }
}