-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pr/122' into beta-branch
- Loading branch information
Showing
63 changed files
with
2,244 additions
and
903 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let NO_DEBUGGER = false; | ||
|
||
let terminal = | ||
NO_DEBUGGER? | ||
{ error: m => m, info: m => m, log: m => m, warn: m => m, group: m => m, groupEnd: m => m }: | ||
console; | ||
|
||
let check; | ||
|
||
check = document.body.onload = event => { | ||
let video = document.querySelector('video'); | ||
|
||
if(video && (video.src || video.textContent)) { | ||
let { src } = video; | ||
|
||
src = src || video.textContent; | ||
|
||
if(/^blob:/i.test(src)) | ||
throw '<blob> URL detected. Unable to reform file.'; | ||
|
||
try { | ||
top.postMessage({ href: src, tail: 'MP4', type: 'SEND_VIDEO_LINK', from: 'consistent' }, '*'); | ||
} catch(error) { | ||
terminal.error('Failed to post message:', error); | ||
} | ||
} else { | ||
setTimeout(check, 500); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let NO_DEBUGGER = false; | ||
|
||
let terminal = | ||
NO_DEBUGGER? | ||
{ error: m => m, info: m => m, log: m => m, warn: m => m, group: m => m, groupEnd: m => m }: | ||
console; | ||
|
||
let check; | ||
|
||
check = document.body.onload = event => { | ||
let video = document.querySelector('video'); | ||
|
||
if(video && (video.src || video.textContent)) { | ||
let { src } = video; | ||
|
||
src = src || video.textContent; | ||
|
||
if(/^blob:/i.test(src)) | ||
throw '<blob> URL detected. Unable to reform file.'; | ||
|
||
try { | ||
top.postMessage({ href: src, tail: 'MP4', type: 'SEND_VIDEO_LINK', from: 'fembed' }, '*'); | ||
} catch(error) { | ||
terminal.error('Failed to post message:', error); | ||
} | ||
} else { | ||
setTimeout(check, 500); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let NO_DEBUGGER = false; | ||
|
||
let terminal = | ||
NO_DEBUGGER? | ||
{ error: m => m, info: m => m, log: m => m, warn: m => m, group: m => m, groupEnd: m => m }: | ||
console; | ||
|
||
let check; | ||
|
||
check = document.body.onload = event => { | ||
let video = document.querySelector('video'); | ||
|
||
if(video && (video.src || video.textContent)) { | ||
let { src } = video; | ||
|
||
src = src || video.textContent; | ||
|
||
if(/^blob:/i.test(src)) | ||
throw '<blob> URL detected. Unable to reform file.'; | ||
|
||
try { | ||
top.postMessage({ href: src, tail: 'MP4', type: 'SEND_VIDEO_LINK', from: 'gounlimited' }, '*'); | ||
} catch(error) { | ||
terminal.error('Failed to post message:', error); | ||
} | ||
} else { | ||
setTimeout(check, 500); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let NO_DEBUGGER = false; | ||
|
||
let terminal = | ||
NO_DEBUGGER? | ||
{ error: m => m, info: m => m, log: m => m, warn: m => m, group: m => m, groupEnd: m => m }: | ||
console; | ||
|
||
let check; | ||
|
||
check = document.body.onload = event => { | ||
let video = document.querySelector('div > p + p'); | ||
|
||
if(video && (video.src || video.textContent)) { | ||
let { src } = video; | ||
|
||
src = src || video.textContent; | ||
|
||
if(/^blob:/i.test(src)) | ||
throw '<blob> URL detected. Unable to reform file.'; | ||
|
||
try { | ||
top.postMessage({ href: `https://oload.fun/stream/${ src }?mime=true`, tail: 'MP4', type: 'SEND_VIDEO_LINK', from: 'oload' }, '*'); | ||
} catch(error) { | ||
terminal.error('Failed to post message:', error); | ||
} | ||
} else { | ||
setTimeout(check, 500); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/** plxdwnld - Pip Longrun / Ephellon | ||
* | ||
* This project is licensed under the terms of the MIT license, see https://piplongrun.github.io/plxdwnld/LICENSE.txt | ||
* | ||
* @author Pip Longrun <pip.longrun@protonmail.com> | ||
* @version 0.2 | ||
* @see https://piplongrun.github.io/plxdwnld/ | ||
* | ||
*/ | ||
|
||
let plxdwnld = (() => { | ||
let self = {}, R = RegExp, | ||
baseURI, AccessToken, | ||
RegExps = { | ||
clientID: /server\/([a-f\d]{40})\//i, | ||
metadataID: /key=%2Flibrary%2Fmetadata%2F(\d+)/i, | ||
}, | ||
URLExps = { | ||
API_resource: 'https://plex.tv/api/resources?includeHttps=1&X-Plex-Token={token}', | ||
API_library: '{baseuri}/library/metadata/{id}?X-Plex-Token={token}', | ||
download: '{baseuri}{partkey}?download=1&X-Plex-Token={token}', | ||
}, | ||
access_token_path = '//Device[@clientIdentifier=\'{clientID}\']/@accessToken', | ||
base_uri_path = '//Device[@clientIdentifier=\'{clientID}\']/Connection[@local=0]/@uri', | ||
part_key_path = '//Media/Part[1]/@key'; | ||
|
||
// Errors | ||
let ERROR = { | ||
EMPTY: 'No response data was received', | ||
NOT_PLEX: 'You are not browsing (or logged into) Plex', | ||
NOT_MEDIA: 'You are not viewing a media item', | ||
INVALID_TOKEN: 'Unable to find a valid Access Token', | ||
}; | ||
|
||
let getXML = (url, callback) => { | ||
fetch(`//cors-anywhere.herokuapp.com/${ url }`, { method: 'GET', headers: { 'X-Requested-With': 'XMLHttpRequest' } }) | ||
.then(Q => Q.text()) | ||
.then(text => { | ||
if(!text.length) | ||
throw ERROR.EMPTY; | ||
|
||
let Parser = new DOMParser(), | ||
XML = Parser.parseFromString(text, 'text/xml'); | ||
|
||
callback(XML); | ||
}) | ||
.catch(error => { throw error }); | ||
}; | ||
|
||
let getMetadata = (XML) => { | ||
let clientID = RegExps.clientID.test(location.href)? | ||
R.$1: | ||
null; | ||
|
||
if(clientID) { | ||
let access_token_node = XML.evaluate( | ||
access_token_path.replace(/{clientid}/ig, clientID), | ||
XML, | ||
null, | ||
XPathResult.FIRST_ORDERED_NODE_TYPE, | ||
null | ||
), | ||
base_uri_node = XML.evaluate( | ||
base_uri_path.replace(/{clientid}/ig, clientID), | ||
XML, | ||
null, | ||
XPathResult.FIRST_ORDERED_NODE_TYPE, | ||
null | ||
); | ||
|
||
if(access_token_node.singleNodeValue && base_uri_node.singleNodeValue) { | ||
AccessToken = access_token_node.singleNodeValue.textContent; | ||
baseURI = base_uri_node.singleNodeValue.textContent; | ||
|
||
let metadataID = RegExps.metadataID.test(location.href)? | ||
R.$1: | ||
null; | ||
|
||
if(metadataID) | ||
getXML( | ||
URLExps.API_library | ||
.replace(/{baseuri}/ig, baseURI) | ||
.replace(/{id}/ig, metadataID) | ||
.replace(/{token}/ig, AccessToken) | ||
, GetDownloadURL | ||
); | ||
else | ||
throw ERROR.NOT_MEDIA; | ||
} else { | ||
throw ERROR.INVALID_TOKEN; | ||
} | ||
} else { | ||
throw ERROR.NOT_MEDIA; | ||
} | ||
}; | ||
|
||
let GetDownloadURL = (XML) => { | ||
let part_key_node = XML.evaluate(part_key_path, XML, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null); | ||
|
||
if(part_key_node.singleNodeValue) { | ||
let href = URLExps.download | ||
.replace(/{baseuri}/ig, baseURI) | ||
.replace(/{partkey}/ig, part_key_node.singleNodeValue.textContent) | ||
.replace(/{token}/ig, AccessToken); | ||
|
||
top.postMessage({ href, tail: 'MP4', type: 'SEND_VIDEO_LINK', from: 'plex' }, '*'); | ||
} else { | ||
throw ERROR.NOT_MEDIA; | ||
} | ||
}; | ||
|
||
self.init = () => { | ||
if(localStorage.myPlexAccessToken !== undefined) | ||
getXML(URLExps.API_resource.replace(/{token}/ig, localStorage.myPlexAccessToken), getMetadata); | ||
else | ||
throw ERROR.NOT_PLEX; | ||
}; | ||
|
||
return self; | ||
})(); | ||
|
||
let NO_DEBUGGER = false; | ||
|
||
let terminal = | ||
NO_DEBUGGER? | ||
{ error: m => m, info: m => m, log: m => m, warn: m => m, group: m => m, groupEnd: m => m }: | ||
console; | ||
|
||
let check; | ||
|
||
check = document.body.onload = event => { | ||
let loading = document.querySelector('.loading'); | ||
|
||
if(!loading) { | ||
setTimeout(() => { | ||
try { | ||
plxdwnld.init(); | ||
} catch(error) { | ||
terminal.error('Failed to post message:', error); | ||
setTimeout(check, 5000); | ||
} | ||
}, 5000) | ||
} else { | ||
setTimeout(check, 500); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.