JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 18.08.2018, 20:18
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default [Decrypter Request] kickassanime.io

If you DeepAnalyze entries on kickassanime.io (example: **External links are only visible to Support Staff****External links are only visible to Support Staff**)it already recognizes the linked files, but doesn't apply the episode title from the H1 tag above and won't use the show name in the upper left nav entry for the folder name either.
Cherry on top would be if the decrypter was triggered automatically when an episode URL like the one above is copied into the clipboard, same goes for detecting the episode list on a list page like **External links are only visible to Support Staff****External links are only visible to Support Staff** and looping over the individual entries.

I wanted to contribute a decrypter myself, but it's been about ten years since I last wrote plain Java code and couldn't even figure out whether my class was even triggered and if, where my log entries would end up, much less showing them in a UI element for easy copying during the dev/debug stage.
Seems I was also too late to reach a project member in the IRC channel as well on Friday and the general channel mutes new/unknown users, so asking there is impossible as well.

Last edited by raztoki; 19.08.2018 at 03:21.
Reply With Quote
  #2  
Old 19.08.2018, 03:23
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,659
Default

for memory the for this site has been closed sourced, as in you wont find it on our public repository. Since the plugin already exists, I'm sure its just a matter of either url pattern change or slight html change, so the existing plugin would need updating.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3  
Old 19.08.2018, 04:59
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

It's a different site than KissAnime and its sister sites covered by KisAmeCm.java, so I'm not quite sure what you mean.
Reply With Quote
  #4  
Old 19.08.2018, 07:25
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,659
Default

sorry i should have checked to see which location the class was in before making the last post, its public class.

ok so not the same site, seems you do need to login in order to see content?

raztoki
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #5  
Old 19.08.2018, 10:08
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

No login required.

I've managed to get a skeleton running, but hat do I need to call to let the default functionality grab hoster links on the site so I just have to fix the names? Learning from existing plugins is a good approach, but with so many existing ones i'm searching for a needle in a haystack.

Code:
package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "kickassanime.io" }, urls = { "**External links are only visible to Support Staff** })

public class KickAssAnimeIo extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public KickAssAnimeIo(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();

        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);

        // single episode page
        String episodeURL = parameter;
        String showTitle = br.getRegex("<a href=\"**External links are only visible to Support Staff** title=\"(.+?)\">").getMatch(0);
        String episodeTitle = br.getRegex(">([^>]+)</h1>").getMatch(0);

        // TODO:
        // 1. Let the default behavior to harvest the host URLs as usual (no need to reinvent the wheel).
        // 2. Loop over the entries and fix the file name, keeping the extension.

        final FilePackage fp = FilePackage.getInstance();
        fp.setName(showTitle.trim());
        fp.addLinks(decryptedLinks);

        System.out.println("breakpoint");

        return decryptedLinks;
    }

}
Reply With Quote
  #6  
Old 19.08.2018, 15:53
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,659
Default

if its just a site that has links, you typically just have to find content and return it, as supported content will trigger on said urls, then those plugins do there thing. If its not supported by a dedicated plugin then a generic like DirectHTTP class might trigger if its known file extension. Else you can force it by prefix of 'direc**External links are only visible to Support Staff** + 'url'. typically here also you will need to specify the filename as the generic plugin probably wont be able to determine it since its not a known file extension. Use of filepackage is useful to group common findings into single package.

raztoki
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #7  
Old 19.08.2018, 20:47
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

Sorry, I'm still trying to wrap my head around this.

Feels like I'm trying to reinvent the wheel and screwing up in the process.

Before, using DeepAnalyze the correct files were grabbed and the only necessary extra step for this new class would've been to set the names for the download link and the file package, now I manage to read some URLs with my code but I'm grabbing nothing at all and I'm obviously missing some connection.
Thanks in advance for any advice you can provide.

The stream I'm trying it on is **External links are only visible to Support Staff****External links are only visible to Support Staff**

Code:
package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "kickassanime.io" }, urls = { "**External links are only visible to Support Staff** })

public class KickAssAnime extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public KickAssAnime(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();

        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);

        String showTitle = br.getRegex("<a href=\"**External links are only visible to Support Staff** title=\"(.+?)\">").getMatch(0);
        String episodeTitle = br.getRegex(">([^>]+)</h1>").getMatch(0);

        String[][] playerURLGroups = br.getRegex("**External links are only visible to Support Staff**]+").getMatches();

        final Browser brIframe = br.cloneBrowser();
        brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");

        for (String[] playerURLGroup : playerURLGroups) {
            String iframeURL = java.net.URLDecoder.decode(playerURLGroup[0], "UTF-8"); // Player Iframe on the video page
            String iframePage = brIframe.getPage(iframeURL);

            if (iframeURL != null) {
                DownloadLink downloadLink = createDownloadlink(iframeURL);
                downloadLink.setName(episodeTitle);
                decryptedLinks.add(downloadLink);
            }

            System.out.println("iframeURL: " + iframeURL);
            String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin

            if (videoURL != null) {
                DownloadLink downloadLink = createDownloadlink(videoURL);
                downloadLink.setName(episodeTitle);
                decryptedLinks.add(downloadLink);
            }

            System.out.println("videoURL: " + videoURL);
            System.out.println("breakpoint");
        }

        final FilePackage fp = FilePackage.getInstance();
        fp.setName(showTitle);
        fp.addLinks(decryptedLinks);

        return decryptedLinks;
    }
}
Reply With Quote
  #8  
Old 20.08.2018, 13:05
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

Seems like it's almost working for at least one URL, but for some reason it's throwing a ConcurrentModificationExceptionand I can't see the woods for all the trees:

Code:
package jd.plugins.decrypter;

import java.io.IOException;
import java.util.ArrayList;

import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "kickassanime.io" }, urls = { "**External links are only visible to Support Staff** })

public class KickAssAnime extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public KickAssAnime(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    @SuppressWarnings("deprecation")
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();

        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);
        String showTitle = br.getRegex("<a href=\"**External links are only visible to Support Staff** title=\"(.+?)\">").getMatch(0);
        String episodeTitle = br.getRegex(">([^>]+)</h1>").getMatch(0);

        String[][] iframeURLMatches = br.getRegex("**External links are only visible to Support Staff**]+").getMatches();

        for (String[] iframeURLMatch : iframeURLMatches) {
            String iframeURL = iframeURLMatch[0];
            if (iframeURL != null) {
                iframeURL = Encoding.htmlDecode(iframeURL);
                appendAndInvestigateRedirect(decryptedLinks, iframeURL);

                final Browser brIframe = br.cloneBrowser();
                brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");
                String iframePage = brIframe.getPage(iframeURL);
                String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin

                if (videoURL != null) {
                    appendAndInvestigateRedirect(decryptedLinks, videoURL);

                    String dataURL = brIframe.getRegex("data=(.+?)&").getMatch(0);
                    appendAndInvestigateRedirect(decryptedLinks, dataURL);
                }
            }
        }

        handleEncodedRemotes(decryptedLinks);

        final FilePackage filePackage = FilePackage.getInstance();
        filePackage.setName(showTitle);
        filePackage.addLinks(decryptedLinks);

        logLinksForDebug(decryptedLinks);

        return decryptedLinks;
    }

    private void logLinksForDebug(ArrayList<DownloadLink> downloadLinks) {
        for (DownloadLink downloadLink : downloadLinks) {
            System.out.println("downloadLink: " + downloadLink.getPluginPatternMatcher());
        }
    }

    private String getRedirectURL(String url) throws Exception {
        String redirectURL = new String();

        if (url != null) {
            final Browser brRedirect = br.cloneBrowser();
            brRedirect.setFollowRedirects(false);
            String redirectPage = brRedirect.getPage(url);
            redirectURL = brRedirect.getRedirectLocation();
        }

        return redirectURL;
    }

    private void appendAndInvestigateRedirect(ArrayList<DownloadLink> decryptedLinks, String url) throws Exception {
        if (url != null) {
            url = Encoding.htmlDecode(url);
            decryptedLinks.add(createDownloadlink(url));

            String redirectDataURL = getRedirectURL(url);
            if (redirectDataURL != null) {
                decryptedLinks.add(createDownloadlink(redirectDataURL));
            }
        }
    }

    private void handleEncodedRemotes(ArrayList<DownloadLink> decryptedLinks) throws IOException {
        for (DownloadLink decryptedLink : decryptedLinks) {
            String remoteURL = decryptedLink.getPluginPatternMatcher();

            if (remoteURL != null) {
                final Browser brRemote = br.cloneBrowser();
                brRemote.setFollowRedirects(true);
                String page = brRemote.getPage(remoteURL);

                if (page.contains("document.write(Base64.decode")) {
                    String videoURL = brRemote.getRegex("document\\.write\\(Base64\\.decode\\(\"(.+?)\\\"").getMatch(0);
                    String output = Encoding.Base64Decode(videoURL);
                    String embeddedURL = new Regex(output, "src=(.+?) allowfullscreen").getMatch(0);

                    if (embeddedURL != null) {
                        embeddedURL = Encoding.htmlDecode(embeddedURL);
                        decryptedLinks.add(createDownloadlink(embeddedURL));
                    }
                }
            }
        }
    }

}
Reply With Quote
  #9  
Old 20.08.2018, 20:00
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

I think that's actually it.
Do these things chain based on the results? In other words, can I write another decrypter that matches the pattern of the links this one returns and they'll run one after another? I think my problem is that they embed content from another site in an IFrame, which in turn uses various Javascript work to embed the actual content.

Solving both things as separate steps like that would make it easier to debug.
For better understanding: This site embeds stuff on animo-pace-stream.io, where the actual player Javascript holding the eventual hoster URLs lives.

Code:
package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "kickassanime.io" }, urls = { "**External links are only visible to Support Staff** })
public class KickAssAnime extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public KickAssAnime(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    @SuppressWarnings("deprecation")
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);
        String showTitle = br.getRegex("<a href=\"**External links are only visible to Support Staff** title=\"(.+?)\">").getMatch(0);
        String episodeTitle = br.getRegex(">([^>]+)</h1>").getMatch(0);
        String[][] iframeURLMatches = br.getRegex("**External links are only visible to Support Staff**]+").getMatches();
        // Get the IFrame details, which might contain our target URLs
        for (String[] iframeURLMatch : iframeURLMatches) {
            String iframeURL = iframeURLMatch[0];
            if (iframeURL != null) {
                iframeURL = Encoding.htmlDecode(iframeURL);
                decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(iframeURL)));
                final Browser brIframe = br.cloneBrowser();
                brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");
                String iframePage = brIframe.getPage(iframeURL);
                String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin
                if (videoURL != null) {
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(videoURL)));
                    String dataURL = brIframe.getRegex("data=(.+?)&").getMatch(0);
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(dataURL)));
                }
            }
        }
        final FilePackage filePackage = FilePackage.getInstance();
        filePackage.setName(showTitle);
        filePackage.addLinks(decryptedLinks);
        logLinksForDebug(decryptedLinks);
        return decryptedLinks;
    }

    private void logLinksForDebug(ArrayList<DownloadLink> downloadLinks) {
        for (DownloadLink downloadLink : downloadLinks) {
            logger.info("downloadLink: " + downloadLink.getPluginPatternMatcher());
        }
    }
}

Last edited by Iskelderon; 20.08.2018 at 20:03.
Reply With Quote
  #10  
Old 20.08.2018, 20:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,342
Default

Plugins can handle one more more supported url/pattern and decrypter return 1-x links.
JDownloader then checks resulting link/s and either finds a decrypter plugin matching that link or a hoster plugin.

For example site A hosts videos on B, then plugin A should find/return all content/videos and return the links and plugin B should match on the supported videos for further handling/processing.

In case the video handling is special to a site and only used by it, you can also implement the support within the same plugin and no need for additional plugins
__________________
JD-Dev & Server-Admin
Reply With Quote
  #11  
Old 20.08.2018, 20:21
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

Thanks, good to know that chaining like that is possible since jDownloader checks the returned URLs against other existing plugins in general and not just hoster plugins.
Reply With Quote
  #12  
Old 20.08.2018, 20:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,342
Default

Chaining/Linkcrawler is one of the strong powers of JDownloader. At the moment there are support for several thousand sites
__________________
JD-Dev & Server-Admin
Reply With Quote
  #13  
Old 21.08.2018, 08:13
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,510
Default

@Iskelderon
This will create links:
Code:
            if (iframeURL != null) {
                // iframeURL = Encoding.htmlDecode(iframeURL);
                // decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(iframeURL)));
                final Browser brIframe = br.cloneBrowser();
                brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");
                String iframePage = brIframe.getPage(iframeURL);
                if (brIframe.getHttpConnection().getResponseCode() == 403) {
                    brIframe.getPage(Encoding.htmlDecode(iframeURL));
                    if (brIframe.getHttpConnection().getResponseCode() == 403) {
                        throw new DecrypterException("Decrypter broken for link: " + parameter);
                    }
                }
                final Browser br2 = br.cloneBrowser();
                String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin
                if (videoURL != null) {
                    br2.getPage(videoURL);
                    String dc = Encoding.Base64Decode(br2.getRegex("Base64.decode\\("([^>"]+)"").getMatch(0));
                    videoURL = new Regex(dc, "src=([^<>"]+) allowfullscreen").getMatch(0);
                    if (videoURL == null) {
                        videoURL = new Regex(dc, "file:"([^<>"]+)"").getMatch(0);
                    }
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(videoURL)));
                }
                String dataURL = brIframe.getRegex("data=(.+?)&").getMatch(0);
                if (dataURL != null) {
                    br2.getPage(dataURL);
                    String dc = Encoding.Base64Decode(br2.getRegex("Base64.decode\\("([^>"]+)"").getMatch(0));
                    logger.info("dc: " + dc);
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(dataURL)));
                }
            }
__________________
FAQ: How to upload a Log
Reply With Quote
  #14  
Old 21.08.2018, 12:45
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,342
Default

Please continue sharing code either in private messages or via mail
__________________
JD-Dev & Server-Admin
Reply With Quote
  #15  
Old 21.08.2018, 13:05
Iskelderon's Avatar
Iskelderon Iskelderon is offline
Bandwidth Beast
 
Join Date: Aug 2018
Location: Europe
Posts: 131
Default

Thanks for your help!
I think I'm still somehow doing it wrong.

Main decrypter:
Code:
package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.Regex;
import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
import jd.nutils.encoding.Encoding;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterException;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "kickassanime.io" }, urls = { "**External links are only visible to Support Staff** })
public class KickAssAnime extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public KickAssAnime(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    @SuppressWarnings("deprecation")
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);
        String showTitle = br.getRegex("<a href=\"**External links are only visible to Support Staff** title=\"(.+?)\">").getMatch(0);
        String episodeTitle = br.getRegex(">([^>]+)</h1>").getMatch(0);
        String[][] iframeURLMatches = br.getRegex("**External links are only visible to Support Staff**]+").getMatches();
        // Get the IFrame details, which might contain our target URLs
        for (String[] iframeURLMatch : iframeURLMatches) {
            String iframeURL = iframeURLMatch[0];
            if (iframeURL != null) {
                iframeURL = Encoding.htmlDecode(iframeURL);
                decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(iframeURL)));
                final Browser brIframe = br.cloneBrowser();
                brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");
                String iframePage = brIframe.getPage(iframeURL);
                String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin
                if (videoURL != null) {
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(videoURL)));
                    String dataURL = brIframe.getRegex("data=(.+?)&").getMatch(0);
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(dataURL)));
                }
            }
            if (iframeURL != null) {
                // iframeURL = Encoding.htmlDecode(iframeURL);
                // decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(iframeURL)));
                final Browser brIframe = br.cloneBrowser();
                brIframe.getHeaders().put("X-Requested-With", "XMLHttpRequest");
                String iframePage = brIframe.getPage(iframeURL);
                if (brIframe.getHttpConnection().getResponseCode() == 403) {
                    brIframe.getPage(Encoding.htmlDecode(iframeURL));
                    if (brIframe.getHttpConnection().getResponseCode() == 403) {
                        throw new DecrypterException("Decrypter broken for link: " + parameter);
                    }
                }
                final Browser br2 = br.cloneBrowser();
                String videoURL = brIframe.getRegex("window.location = '(.+?)'").getMatch(0); // Fed to the IFrame's JWPlayer plugin
                if (videoURL != null) {
                    br2.getPage(videoURL);
                    String dc = Encoding.Base64Decode(br2.getRegex("Base64.decode\\(\"([^>\"]+)\"").getMatch(0));
                    videoURL = new Regex(dc, "src=([^<>\"]+) allowfullscreen").getMatch(0);
                    if (videoURL == null) {
                        videoURL = new Regex(dc, "file:\"([^<>\"]+)\"").getMatch(0);
                    }
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(videoURL)));
                }
                String dataURL = brIframe.getRegex("data=(.+?)&").getMatch(0);
                if (dataURL != null) {
                    br2.getPage(dataURL);
                    String dc = Encoding.Base64Decode(br2.getRegex("Base64.decode\\(\"([^>\"]+)\"").getMatch(0));
                    logger.info("dc: " + dc);
                    decryptedLinks.add(createDownloadlink(Encoding.htmlDecode(dataURL)));
                }
            }
        }
        // Special view sometimes used for self-embeds
        if (!parameter.contains("/episode/addWatch")) {
            decryptedLinks.add(createDownloadlink(parameter + "/episode/addWatch"));
        }
        final FilePackage filePackage = FilePackage.getInstance();
        filePackage.setName(showTitle);
        filePackage.addLinks(decryptedLinks);
        return decryptedLinks;
    }
}


Decrypter for the embedded content site:
Code:
//jDownloader - Downloadmanager
//Copyright (C) 2009  JD-Team support@jdownloader.org
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <**External links are only visible to Support Staff**package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.Regex;
import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.nutils.encoding.Encoding;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "animo-pace-stream.io" }, urls = { "**External links are only visible to Support Staff** })
public class AnimoPaceStream extends PluginForDecrypt {
    protected final LogSource logger = LogController.CL();

    public AnimoPaceStream(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    @SuppressWarnings("deprecation")
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);
        br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
        br.setFollowRedirects(true);
        // Sometimes the target URL is in a Base64-encoded string
        String base64DecodedURL = grabBase64EncodedURL(page);
        if (base64DecodedURL != null && base64DecodedURL.length() > 4) {
            decryptedLinks.add(createDownloadlink(base64DecodedURL));
        }
        // Sometimes the URL is just a plain reference
        String videoURL = br.getRegex("window.location = '(.+?)'").getMatch(0);
        if (videoURL != null) {
            decryptedLinks.add(createDownloadlink(videoURL));
        }
        //
        String[][] selectOptionMatches = br.getRegex("<option value=\"**External links are only visible to Support Staff**).getMatches();
        // Advanced versions use a multi-option player to support several hosters
        if (selectOptionMatches.length > 0) {
            for (String[] selectOptionMatch : selectOptionMatches) {
                String selectOptionURL = Encoding.htmlDecode(selectOptionMatch[0].split("\"")[1]).replace("\"", " ").trim();
                decryptedLinks.add(createDownloadlink(selectOptionURL));
            }
        }
        //
        return decryptedLinks;
    }

    private String grabBase64EncodedURL(String input) {
        String result = new String();
        if (input.contains("document.write(Base64.decode")) {
            String[][] regExMatches = new Regex(input, "document\\.write\\(Base64\\.decode\\(\"(.+?)\\\"").getMatches();
            if (regExMatches.length > 0) {
                String encodedData = regExMatches[0][0];
                result = Encoding.Base64Decode(encodedData);
                regExMatches = new Regex(result, "<iframe[^>]+src=(.+?) ").getMatches();
                if (regExMatches.length > 0) {
                    result = regExMatches[0][0];
                }
            }
        }
        return result;
    }
}
Example for a typical embed: **External links are only visible to Support Staff****External links are only visible to Support Staff**
Example URL for that dropdown type embed: **External links are only visible to Support Staff****External links are only visible to Support Staff**

[EDIT]
Quote:
Originally Posted by Jiaz View Post
Please continue sharing code either in private messages or via mail
Sorry, didn't see that until after submitting this one.
[/EDIT]

Last edited by Iskelderon; 21.08.2018 at 13:08.
Reply With Quote
  #16  
Old 21.08.2018, 13:20
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,342
Default

Nothing to be sorry for. I prefer posting those source to eg a pastebin (hidden) and just link the url here
__________________
JD-Dev & Server-Admin
Reply With Quote
  #17  
Old 21.08.2018, 14:09
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,510
Default

@Iskelderon
My example codes are for replacing part of your codes, not just inserting them.
__________________
FAQ: How to upload a Log
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 11:44.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.