//jDownloader - Downloadmanager_x000D_
//Copyright (C) 2009  JD-Team support@jdownloader.org_x000D_
//_x000D_
//This program is free software: you can redistribute it and/or modify_x000D_
//it under the terms of the GNU General Public License as published by_x000D_
//the Free Software Foundation, either version 3 of the License, or_x000D_
//(at your option) any later version._x000D_
//_x000D_
//This program is distributed in the hope that it will be useful,_x000D_
//but WITHOUT ANY WARRANTY; without even the implied warranty of_x000D_
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the_x000D_
//GNU General Public License for more details._x000D_
//_x000D_
//You should have received a copy of the GNU General Public License_x000D_
//along with this program.  If not, see <http://www.gnu.org/licenses/>._x000D_
package jd.plugins.decrypter;_x000D_
_x000D_
import java.util.ArrayList;_x000D_
import java.util.HashMap;_x000D_
_x000D_
import jd.PluginWrapper;_x000D_
import jd.controlling.ProgressController;_x000D_
import jd.plugins.CryptedLink;_x000D_
import jd.plugins.DecrypterPlugin;_x000D_
import jd.plugins.DownloadLink;_x000D_
import jd.plugins.PluginForDecrypt;_x000D_
_x000D_
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "deredactie.be", "sporza.be", "cobra.canvas.be" }, urls = { "https?://([a-z0-9]+\\.)?deredactie\\.be/(permalink/\\d\\.\\d+(\\?video=\\d\\.\\d+)?|cm/vrtnieuws([^/]+)?/(mediatheek|videozone).+)", "https?://(?:[a-z0-9]+\\.)?sporza\\.be/.*?/(?:mediatheek|videozone).+", "https?://cobra\\.canvas\\.be/.*?/(?:mediatheek|videozone).+" })_x000D_
public class DeredactieBe extends PluginForDecrypt {_x000D_
    public DeredactieBe(PluginWrapper wrapper) {_x000D_
        super(wrapper);_x000D_
    }_x000D_
_x000D_
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {_x000D_
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();_x000D_
        String parameter = param.toString();_x000D_
        this.setBrowserExclusive();_x000D_
        br.setFollowRedirects(true);_x000D_
        br.getPage(parameter);_x000D_
        if (br.getHttpConnection().getResponseCode() == 404 || br.containsHTML("(>Pagina \\- niet gevonden<|>De pagina die u zoekt kan niet gevonden worden)")) {_x000D_
            decryptedLinks.add(this.createOfflinelink(parameter));_x000D_
            return decryptedLinks;_x000D_
        }_x000D_
        HashMap<String, String> mediaValue = new HashMap<String, String>();_x000D_
        for (String[] s : br.getRegex("data\\-video\\-([^=]+)=\"([^\"]+)\"").getMatches()) {_x000D_
            mediaValue.put(s[0], s[1]);_x000D_
        }_x000D_
        final String finalurl = (mediaValue == null || mediaValue.size() == 0) ? null : mediaValue.get("src");_x000D_
        if (finalurl == null) {_x000D_
            try {_x000D_
                decryptedLinks.add(this.createOfflinelink(parameter));_x000D_
            } catch (final Throwable t) {_x000D_
                logger.info("Offline Link: " + parameter);_x000D_
            }_x000D_
            return decryptedLinks;_x000D_
        }_x000D_
        if (finalurl.contains("youtube.com")) {_x000D_
            decryptedLinks.add(createDownloadlink(finalurl));_x000D_
        } else {_x000D_
            decryptedLinks.add(createDownloadlink(parameter.replace(".be/", "decrypted.be/")));_x000D_
        }_x000D_
        return decryptedLinks;_x000D_
    }_x000D_
_x000D_
    /* NO OVERRIDE!! */_x000D_
    public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {_x000D_
        return false;_x000D_
    }_x000D_
}
//([a-z0-9]+\\.)?deredactie\\.be/(permalink/\\d\\.\\d+(\\?video=\\d\\.\\d+)?|cm/vrtnieuws([^/]+)?/(mediatheek|videozone).+)", "https?://(?:[a-z0-9]+\\.)?sporza\\.be/.*?/(?:mediatheek|videozone).+", "https?://cobra\\.canvas\\.be/.*?/(?:mediatheek|videozone).+" })_x000D_
//jDownloader - Downloadmanager_x000D_
//Copyright (C) 2009  JD-Team support@jdownloader.org_x000D_
//_x000D_
//This program is free software: you can redistribute it and/or modify_x000D_
//it under the terms of the GNU General Public License as published by_x000D_
//the Free Software Foundation, either version 3 of the License, or_x000D_
//(at your option) any later version._x000D_
//_x000D_
//This program is distributed in the hope that it will be useful,_x000D_
//but WITHOUT ANY WARRANTY; without even the implied warranty of_x000D_
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the_x000D_
//GNU General Public License for more details._x000D_
//_x000D_
//You should have received a copy of the GNU General Public License_x000D_
//along with this program.  If not, see <http://www.gnu.org/licenses/>._x000D_
package jd.plugins.decrypter;_x000D_
_x000D_
import java.util.ArrayList;_x000D_
import java.util.HashMap;_x000D_
_x000D_
import jd.PluginWrapper;_x000D_
import jd.controlling.ProgressController;_x000D_
import jd.plugins.CryptedLink;_x000D_
import jd.plugins.DecrypterPlugin;_x000D_
import jd.plugins.DownloadLink;_x000D_
import jd.plugins.PluginForDecrypt;_x000D_
_x000D_
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "deredactie.be", "sporza.be", "cobra.canvas.be" }, urls = { "https?://([a-z0-9]+\\.)?deredactie\\.be/(permalink/\\d\\.\\d+(\\?video=\\d\\.\\d+)?|cm/vrtnieuws([^/]+)?/(mediatheek|videozone).+)", "https?://(?:[a-z0-9]+\\.)?sporza\\.be/.*?/(?:mediatheek|videozone).+",<SUF>
public class DeredactieBe extends PluginForDecrypt {_x000D_
    public DeredactieBe(PluginWrapper wrapper) {_x000D_
        super(wrapper);_x000D_
    }_x000D_
_x000D_
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {_x000D_
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();_x000D_
        String parameter = param.toString();_x000D_
        this.setBrowserExclusive();_x000D_
        br.setFollowRedirects(true);_x000D_
        br.getPage(parameter);_x000D_
        if (br.getHttpConnection().getResponseCode() == 404 || br.containsHTML("(>Pagina \\- niet gevonden<|>De pagina die u zoekt kan niet gevonden worden)")) {_x000D_
            decryptedLinks.add(this.createOfflinelink(parameter));_x000D_
            return decryptedLinks;_x000D_
        }_x000D_
        HashMap<String, String> mediaValue = new HashMap<String, String>();_x000D_
        for (String[] s : br.getRegex("data\\-video\\-([^=]+)=\"([^\"]+)\"").getMatches()) {_x000D_
            mediaValue.put(s[0], s[1]);_x000D_
        }_x000D_
        final String finalurl = (mediaValue == null || mediaValue.size() == 0) ? null : mediaValue.get("src");_x000D_
        if (finalurl == null) {_x000D_
            try {_x000D_
                decryptedLinks.add(this.createOfflinelink(parameter));_x000D_
            } catch (final Throwable t) {_x000D_
                logger.info("Offline Link: " + parameter);_x000D_
            }_x000D_
            return decryptedLinks;_x000D_
        }_x000D_
        if (finalurl.contains("youtube.com")) {_x000D_
            decryptedLinks.add(createDownloadlink(finalurl));_x000D_
        } else {_x000D_
            decryptedLinks.add(createDownloadlink(parameter.replace(".be/", "decrypted.be/")));_x000D_
        }_x000D_
        return decryptedLinks;_x000D_
    }_x000D_
_x000D_
    /* NO OVERRIDE!! */_x000D_
    public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {_x000D_
        return false;_x000D_
    }_x000D_
}