Code:
//Scan for NZB urls and grab all data //Trigger: New Crawler Job (Neuer Sammel-Job) // //Uncheck the advanced setting: LinkgrabberSettings.addlinksdialogcheck var myCrawlerJob = job; var myNewLinks = myCrawlerJob.getText(); if (myNewLinks.match(/nzblnk:\?/i)) { var newlines = myNewLinks.split(/\r\n|\r|\n/g); newlines.forEach(function(listentry) { if (listentry.match(/^nzblnk:\?/i)) { var linksplit = listentry.split(/\?/, 2); var valuesplit = linksplit[1].split(/\&/); var newname = ""; var newhash = ""; var newpass = ""; valuesplit.forEach(function(value) { var lastsplit = value.split(/=/, 2); if (lastsplit[0] == "t") { //title newname = lastsplit[1]; } if (lastsplit[0] == "h") { //header newhash = lastsplit[1]; } if (lastsplit[0] == "p") { //password newpass = lastsplit[1]; } }); if (newhash) { var html = ""; var html2 = ""; for (var i = 0; i < 3; ++i) { try { html = getPage("https" + "://www.nzbindex.com/search/rss?q=" + newhash); html2 = getPage("https" + "://www.nzbking.com/search/?q=" + newhash); } catch (e) {} if (html != null && html != "" && html2 != null && html2 != "") { break; } else { sleep(1000); } } if (html != null && html != "" && html2 != null && html2 != "") { var nzburl = html.match(/url="([^"]+)"/); var nzburl2 = html2.match(/href="([^"]+)" class/); var nzblink = ""; if (nzburl) { nzblink = nzburl[1] + ".nzb"; } if (nzburl2) { nzblink = "https" + "://www.nzbking.com" + nzburl2[1] + "#.nzb"; } if (nzblink) { callAPI("linkgrabberv2", "addLinks", { "deepDecrypt": false, "packageName": newname, "extractPassword": newpass, "links": nzblink }); } else { //alert("Kein Ergebnis gefunden."); } } else { //alert("Kein erreichbares Ergebnis gefunden."); } } } }); }