/** Validates- and adds mgids. */ private void addMgid(String mgid) throws IOException, DecrypterException { if (mgid == null) { return; } mgid = cleanMgid(mgid); /* Skip image-mgids - we don't need them! */ if (!isValidMgid(mgid)) { return; } if (mgidIsPlaylist(mgid)) { /* Episode (maybe with multiple segments) */ final String feed_url = jd.plugins.hoster.VivaTv.mgidGetFeedurlForMgid(mgid); if (feed_url == null) { return; } this.br.getPage(feed_url); decryptFeed(); } else { final DownloadLink dl = mgidSingleVideoGetDownloadLink(mgid); if (dl != null) { dl.setContentUrl(this.parameter); this.decryptedLinks.add(dl); } } }
@SuppressWarnings("deprecation") public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception { /* we first have to load the plugin, before we can reference it */ JDUtilities.getPluginForHost("viva.tv"); default_ext = jd.plugins.hoster.VivaTv.default_ext; parameter = param.toString(); jd.plugins.hoster.VivaTv.prepBR(this.br); if (parameter.matches(type_viva) || parameter.matches(type_mtv_de)) { decryptMtvGermanyPlaylists(); } else if (parameter.matches(type_southpark_de_episode)) { decryptSouthparkDe(); } else if (parameter.matches(type_southpark_cc_episode)) { decryptSouthparkCc(); } else if (parameter.matches(type_nickmom_com)) { decryptNickmomCom(); } else if (parameter.matches(type_mtv_com)) { decryptMtvCom(); } else if (parameter.matches(type_logotv_com)) { decrypLogoTvCom(); } else { /* Universal viacom crawler */ this.br.getPage(parameter); vivaUniversalCrawler(); } return decryptedLinks; }
@SuppressWarnings({"unchecked", "rawtypes"}) private void decryptMtvGermanyPlaylists() throws Exception { br.getPage(parameter); fpName = br.getRegex("<title>([^<>\"]*?)</title>").getMatch(0); if (fpName == null) { /* Fallback to url-packagename */ fpName = new Regex(this.parameter, "https?://[^/]+/(.+)").getMatch(0); } ArrayList<Object> ressourcelist = null; LinkedHashMap<String, Object> entries = null; try { final String json = this.br.getRegex("window\\.pagePlaylist = (\\[\\{.*?\\}\\])").getMatch(0); ressourcelist = (ArrayList) JavaScriptEngineFactory.jsonToJavaObject(json); for (final Object object : ressourcelist) { entries = (LinkedHashMap<String, Object>) object; final String path = (String) entries.get("path"); final String url_mrss = (String) entries.get("mrss"); final String title = (String) entries.get("title"); final String subtitle = (String) entries.get("subtitle"); final String video_token = (String) entries.get("video_token"); final String mgid = jd.plugins.hoster.VivaTv.getMGIDOutOfURL(url_mrss); if (url_mrss == null || title == null || video_token == null || mgid == null) { throw new DecrypterException("Decrypter broken for link: " + parameter); } final String contenturl; if (path != null) { contenturl = "http://" + this.br.getHost() + path; } else { contenturl = this.parameter; } String temp_filename = title; if (subtitle != null) { temp_filename += " - " + subtitle; } temp_filename += jd.plugins.hoster.VivaTv.default_ext; final DownloadLink dl = mgidSingleVideoGetDownloadLink(mgid); dl.setLinkID(video_token); dl.setName(temp_filename); dl.setAvailable(true); dl.setContentUrl(contenturl); this.decryptedLinks.add(dl); } } catch (final Throwable e) { return; } final FilePackage fp = FilePackage.getInstance(); fpName = Encoding.htmlDecode(fpName.trim()); fp.setName(fpName); fp.addLinks(decryptedLinks); }
private String doFilenameEncoding(final String filename) { return jd.plugins.hoster.VivaTv.doFilenameEncoding(this, filename); }
private String doEncoding(final String data) { return jd.plugins.hoster.VivaTv.doEncoding(data); }
private String getFEEDtitle(final String source) { return jd.plugins.hoster.VivaTv.feedGetTitle(source); }
private boolean mgidIsSingleVideo(final String mgid) { final String type = jd.plugins.hoster.VivaTv.mgidGetType(mgid); final boolean isvideo = type.equals("video"); return isvideo; }