You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
5.1 KiB
126 lines
5.1 KiB
(async function download() {
|
|
try {
|
|
window.webkit.messageHandlers.jsError.postMessage(document.cookie)
|
|
window.webkit.messageHandlers.jsError.postMessage(window.location.hostname)
|
|
|
|
var links = []
|
|
var linkname = "href"
|
|
window.kplayerUrls = []
|
|
|
|
if (window.location.hostname.endsWith("doorway.com")) {
|
|
links = document.querySelectorAll('a[title="Right click the link below and select save as to download:"]')
|
|
linkname = "href"
|
|
}
|
|
else if (window.location.hostname.endsWith("chaturbate.com")) {
|
|
var u = JSON.parse(window.initialRoomDossier).hls_source
|
|
if (u.indexOf(".m3u8")>0) {
|
|
var base = u.split('/').slice(0,-1).join('/')
|
|
window.webkit.messageHandlers.jsError.postMessage('base: ' + base)
|
|
window.webkit.messageHandlers.jsError.postMessage('url: ' + u)
|
|
var r = await fetch(u)
|
|
var data = await r.text()
|
|
|
|
// Do something with your data
|
|
var lines = data.split('\n')
|
|
|
|
for (let l of lines) {
|
|
if (!l.startsWith("#")) {
|
|
window.webkit.messageHandlers.jsError.postMessage('l: ' + base + l)
|
|
|
|
window.kplayerUrls.push(base + "/" + l)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (window.location.hostname.endsWith("hegre.com")) {
|
|
links = document.querySelectorAll('a[class="members-only"], a[class="image-download"]')
|
|
linkname = "href"
|
|
}
|
|
else if (window.location.hostname.endsWith("dickdrainers.com")) {
|
|
links = document.querySelectorAll('a[title="Right click the link below and select save as to download:"], a[src*="members"]')
|
|
linkname = "href"
|
|
}
|
|
else if (window.location.hostname == "www.kink.com") {
|
|
links = document.querySelectorAll('span[data-resolution="720"], span[data-resolution="1080"]')
|
|
linkname = "data-url"
|
|
}
|
|
else if (window.location.hostname.endsWith("xhamster.com")) {
|
|
var lnks = document.querySelectorAll('link[rel="preload"]')
|
|
|
|
for (var i=0; i<lnks.length; ++i) {
|
|
var u = lnks[i].href
|
|
if (u.indexOf(".m3u8")>0) {
|
|
var base = u.split('/').slice(0,-1).join('/')
|
|
window.webkit.messageHandlers.jsError.postMessage('base: ' + base)
|
|
window.webkit.messageHandlers.jsError.postMessage('url: ' + u)
|
|
var r = await fetch(u)
|
|
var data = await r.text()
|
|
|
|
// Do something with your data
|
|
var lines = data.split('\n')
|
|
|
|
for (let l of lines) {
|
|
if (!l.startsWith("#")) {
|
|
window.webkit.messageHandlers.jsError.postMessage('l: ' + base + l)
|
|
|
|
window.kplayerUrls.push(base + "/" + l)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (window.location.hostname.endsWith("xvideos.com")) {
|
|
if (html5player) {
|
|
if (html5player.url_hls) {
|
|
var u = html5player.url_hls
|
|
window.webkit.messageHandlers.jsError.postMessage(u)
|
|
|
|
if (u.indexOf("hls.m3u8")>0) {
|
|
var base = u.split('/').slice(0,-1).join('/')
|
|
var r = await fetch(u)
|
|
var data = await r.text()
|
|
|
|
// Do something with your data
|
|
var lines = data.split('\n')
|
|
|
|
for (let l of lines) {
|
|
if (!l.startsWith("#")) {
|
|
window.kplayerUrls.push(base + "/" + l)
|
|
}
|
|
}
|
|
}
|
|
window.webkit.messageHandlers.jsError.postMessage(JSON.stringify(window.kplayerUrls))
|
|
|
|
window.kplayerUrls.push(u)
|
|
}
|
|
}
|
|
}
|
|
|
|
links.forEach(
|
|
function(currentValue, currentIndex, listObj) {
|
|
window.webkit.messageHandlers.jsError.postMessage(JSON.stringify(currentValue))
|
|
|
|
window.kplayerUrls.push(currentValue.getAttribute(linkname))
|
|
},
|
|
'myThisArg'
|
|
);
|
|
window.webkit.messageHandlers.openDocument.postMessage(JSON.stringify(window.kplayerUrls));
|
|
|
|
// window.webkit.messageHandlers.jsError.postMessage("k"+links);
|
|
// we use a second try block here to have more detailed error information
|
|
// because of the nature of JS the outer try-catch doesn't know anything where the error happended
|
|
let res;
|
|
try {
|
|
|
|
} catch (err) {
|
|
window.webkit.messageHandlers.jsError.postMessage('fetch threw, error: '+ err );
|
|
return;
|
|
}
|
|
} catch (err) {
|
|
window.webkit.messageHandlers.jsError.postMessage('fetch threw, error: '+ err);
|
|
return;
|
|
}
|
|
})();
|
|
// null is needed here as this eval returns the last statement and we can't return a promise
|
|
null;
|