From f08de0bd4d8e2f8b04b12b720700d39eac09850f Mon Sep 17 00:00:00 2001 From: Jaro Date: Wed, 24 Feb 2021 08:36:38 +0100 Subject: [PATCH] VideaCesky.cz decrypter plugin --- src/jd/plugins/decrypter/VideaCesky.java | 85 ++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/jd/plugins/decrypter/VideaCesky.java diff --git a/src/jd/plugins/decrypter/VideaCesky.java b/src/jd/plugins/decrypter/VideaCesky.java new file mode 100644 index 0000000..7529a07 --- /dev/null +++ b/src/jd/plugins/decrypter/VideaCesky.java @@ -0,0 +1,85 @@ +//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 . +package jd.plugins.decrypter; + +import java.util.ArrayList; + +import jd.PluginWrapper; +import jd.controlling.ProgressController; +import jd.http.URLConnectionAdapter; +import jd.plugins.CryptedLink; +import jd.plugins.DecrypterPlugin; +import jd.plugins.DownloadLink; +import jd.plugins.FilePackage; +import jd.plugins.LinkStatus; +import jd.plugins.PluginException; +import jd.plugins.PluginForDecrypt; + +@DecrypterPlugin(revision = "$Revision: 42805 $", interfaceVersion = 3, names = { "videacesky.cz" }, urls = { "https?://(?:www\\.)?(?:videacesky\\.cz)/(?:video)/[A-Za-z0-9-]+" }) +public class VideaCesky extends PluginForDecrypt { + public VideaCesky(PluginWrapper wrapper) { + super(wrapper); + } + + public ArrayList decryptIt(CryptedLink param, ProgressController progress) throws Exception { + final ArrayList decryptedLinks = new ArrayList(); + final String parameter = param.toString(); + br.setFollowRedirects(true); + br.getPage(parameter); + if (br.getHttpConnection().getResponseCode() == 404) { + decryptedLinks.add(this.createOfflinelink(parameter)); + return decryptedLinks; + } + final String link = this.br.getRegex("file:\\s*'(http[^<>\"]*?)'").getMatch(0); + final String title = this.br.getRegex("title:\\s*'(.*?)'").getMatch(0); + final String srtfile = this.br.getRegex("file:\\s*\"(.*?)\"").getMatch(0); + final String srtlabel = this.br.getRegex("label:\\s*\"(.*?)\"").getMatch(0); + final FilePackage fp = FilePackage.getInstance(); + fp.setName(title); + // Add link to youtube video + decryptedLinks.add(createDownloadlink(link)); + // Add link to srt file for player + final String srt_link = "http://videacesky.cz" + srtfile; + DownloadLink dl2 = createDownloadlink(srt_link); + dl2.setContentUrl(srt_link); + final String srt_file = title + "." + srtlabel + ".srt"; + dl2.setName(srt_file); + dl2.setFinalFileName(srt_file); + dl2.setAvailable(true); + decryptedLinks.add(dl2); + for (DownloadLink d : decryptedLinks) { + logger.info(d.getContentUrl()); + } + long filesize = -1; + URLConnectionAdapter con = null; + try { + con = br.openHeadConnection(srt_link); + if (!con.getContentType().contains("html")) { + filesize = con.getLongContentLength(); + } else { + throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); + } + } finally { + try { + con.disconnect(); + } catch (final Throwable e) { + } + } + dl2.setDownloadSize(filesize); + fp.addLinks(decryptedLinks); + return decryptedLinks; + } +} \ No newline at end of file