View Single Post
  #789  
Old 19.06.2019, 06:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 612
Default

Quote:
Originally Posted by SMS View Post
If the file *720.mp4 is offline (HTTP status 404), replace 720 by 480 in the URL.
Can add a new url, based on the current one, if it is offline. Cannot modify/remove it using script.

Code:
// Add alternate url, if current url is offline
// Trigger : Packagizer Hook

if (state == "BEFORE") {
    var url = link.getURL();
    if (url && link.getLinkState() == "OFFLINE" && (/.+720.mp4$/).test(url)) {
        callAPI("linkgrabberv2", "addLinks", {
            "links": url.replace(/(.+)720.mp4/, "$1480.mp4")
        });
    }
}
Reply With Quote