LImgDLer

Auto-DL

Versión del día 24/9/2021. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name     LImgDLer
// @version  1.6
// @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==

var name;
var phonews;
var NAMERAW, PHONE;
jQuery(function() {
    hideSpam();
    setupMutationObserver();
    if (jQuery('.kuenstlername').length) { // modern mode
        NAMERAW = jQuery('.kuenstlername').first().text();
        PHONE = jQuery('.contacts-data strong').first().text();
    } else if (jQuery('.auftrag-name h3').length) { // themenladies
        NAMERAW = jQuery('.auftrag-name h3').first().text();
        PHONE = jQuery('p.telefon strong').first().text();
    } else if (jQuery('div.full_pad.bigfont strong').length) { // classic
        NAMERAW = jQuery('div.full_pad.bigfont strong').text();
        PHONE = jQuery('.div_td_last.lalign.midfont.itxt_pad.icon_text').eq(1).text();
    }
    PHONE = PHONE.replace(/ \/ /,'-');
    let NAME = NAMERAW.replace(/[^\w-\(\) ]/g,'');
    name = NAME + ' - ' + PHONE
    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>'
                   +'<button id="copybutton">📋 copy Text</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'));
    });
    jQuery('body').on('click', '#copybutton', function(event) {
        navigator.clipboard.writeText(adData());
    });

    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 adData() {
    let phone = phonews.replace(/\+49\(0\)/,'0');
    let phone2 = phone.replace(/[/\-]/g,'');
    let phone3 = phone2.replace(/^0([1-9])/,'+49$1');
    let text = jQuery('.row_anzeigentext .einzelansicht-text')
        .clone()    //clone the element
        .children() //select all the children
        .remove()   //remove all the children
        .end()
        .text()
        .replace(/\t/g,'')
    .replace(/\n{2,}/g,"\n")
    .replace(/\W+$/g,'')
    ;

    let daten = "";

    jQuery('.trait-attributes .attribute-column').each(function(){
        let key = jQuery(this).find('strong').first().text().replace(/(^\s+|\s+$)/g,'');
        console.log(this);
        let value = jQuery(this).find('div div').last().text().replace(/(^\s+|\s+$)/g,'').replace(/[\s\n]+/g,', ').replace(/,+/g,',');
  //      if (key.length && value.length) {
            if (daten.length) daten += ", ";
            daten += `${key}: [B]${value}[/B]`;
    //    }
    });

    let clubname = jQuery('[itemprop=location]').first().text();
    let clublink = jQuery('div#clublink a').text().replace(/> /,'');
    let club = '';
    if (clubname) {
        club = `[URL=https://ladies.de${clublink}]${clubname}[/URL], `;
    }
    let URL = window.location.href;
    let address =
        (jQuery('[itemprop=address] [itemprop=streetAddress]').first().text() || '')
        + ", "
        + (jQuery('[itemprop=address] [itemprop=postalCode]').first().attr('content') || '')
        + " "
        + (jQuery('[itemprop=address] [itemprop=addressLocality]').first().text() || jQuery('.contacts-data .address-details').first().text().replace(/[\s\n]+/g,' ').replace(/(^[\s\n]+|[\s\n]+$)/g,'') || '');

    let service = jQuery('div#attribute .profil .column-list .attribute-item').text()
        .replace(/\s+/g,' ');

    let languages = '';
    let dataHTML= `Infoservice\n[QUOTE][SIZE="1"][URL=${URL}][B]${NAMERAW}[/B][/URL]\n\n${text}\n\n`
        +`${daten}\n\n`
        +`[B]Telefon:[/B] ${phone}, ${phone2}, ${phone3}\n`
        +`[B]Adresse:[/B] ${club}${address}\n`
        +`[B]Service:[/B] ${service}\n`
        +`[/SIZE][/QUOTE]`;
    dataHTML = dataHTML.replace(/ {2,}/g,' ').replace(/\n{3,}/,'\n\n');
    return dataHTML;
}
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]);
    }
}