Skip to content

Commit 1baa59f

Browse files
author
updating-bot
committed
mirroring bot - 2025/08/05
1 parent f29564e commit 1baa59f

File tree

12 files changed

+467
-87
lines changed

12 files changed

+467
-87
lines changed

svn_trunk/src/jd/plugins/decrypter/Ardmediathek.java

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,6 @@
2828
import java.util.Map;
2929
import java.util.Map.Entry;
3030

31-
import jd.PluginWrapper;
32-
import jd.controlling.ProgressController;
33-
import jd.http.Browser;
34-
import jd.http.URLConnectionAdapter;
35-
import jd.nutils.encoding.Encoding;
36-
import jd.parser.Regex;
37-
import jd.plugins.CryptedLink;
38-
import jd.plugins.DecrypterPlugin;
39-
import jd.plugins.DecrypterRetryException;
40-
import jd.plugins.DecrypterRetryException.RetryReason;
41-
import jd.plugins.DownloadLink;
42-
import jd.plugins.FilePackage;
43-
import jd.plugins.LinkStatus;
44-
import jd.plugins.Plugin;
45-
import jd.plugins.PluginBrowser;
46-
import jd.plugins.PluginException;
47-
import jd.plugins.PluginForDecrypt;
48-
import jd.plugins.components.MediathekHelper;
49-
import jd.plugins.components.PluginJSonUtils;
50-
import jd.plugins.hoster.ARDMediathek;
51-
5231
import org.appwork.storage.TypeRef;
5332
import org.appwork.utils.DebugMode;
5433
import org.appwork.utils.Hash;
@@ -73,7 +52,28 @@
7352
import org.jdownloader.plugins.controller.LazyPlugin;
7453
import org.jdownloader.scripting.JavaScriptEngineFactory;
7554

76-
@DecrypterPlugin(revision = "$Revision: 51211 $", interfaceVersion = 3, names = { "ardmediathek.de", "daserste.de", "sandmann.de", "wdr.de", "sportschau.de", "wdrmaus.de", "eurovision.de", "sputnik.de", "mdr.de", "ndr.de", "tagesschau.de" }, urls = { "https?://(?:\\w+\\.)?ardmediathek\\.de/.+", "https?://(?:\\w+\\.)?daserste\\.de/.*?\\.html", "https?://(?:www\\.)?sandmann\\.de/.+", "https?://(?:\\w+\\.)?wdr\\.de/[^<>\"]+\\.html|https?://deviceids-[a-z0-9\\-]+\\.wdr\\.de/ondemand/\\d+/\\d+\\.js", "https?://(?:\\w+\\.)?sportschau\\.de/.*?\\.html", "https?://(?:\\w+\\.)?wdrmaus\\.de/.+", "https?://(?:\\w+\\.)?eurovision\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?sputnik\\.de/[^<>\"]+\\.html", "https?://(?:www\\.)?mdr\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?ndr\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?tagesschau\\.de/[^<>\"]+\\.html" })
55+
import jd.PluginWrapper;
56+
import jd.controlling.ProgressController;
57+
import jd.http.Browser;
58+
import jd.http.URLConnectionAdapter;
59+
import jd.nutils.encoding.Encoding;
60+
import jd.parser.Regex;
61+
import jd.plugins.CryptedLink;
62+
import jd.plugins.DecrypterPlugin;
63+
import jd.plugins.DecrypterRetryException;
64+
import jd.plugins.DecrypterRetryException.RetryReason;
65+
import jd.plugins.DownloadLink;
66+
import jd.plugins.FilePackage;
67+
import jd.plugins.LinkStatus;
68+
import jd.plugins.Plugin;
69+
import jd.plugins.PluginBrowser;
70+
import jd.plugins.PluginException;
71+
import jd.plugins.PluginForDecrypt;
72+
import jd.plugins.components.MediathekHelper;
73+
import jd.plugins.components.PluginJSonUtils;
74+
import jd.plugins.hoster.ARDMediathek;
75+
76+
@DecrypterPlugin(revision = "$Revision: 51303 $", interfaceVersion = 3, names = { "ardmediathek.de", "daserste.de", "sandmann.de", "wdr.de", "sportschau.de", "wdrmaus.de", "eurovision.de", "sputnik.de", "mdr.de", "ndr.de", "tagesschau.de" }, urls = { "https?://(?:\\w+\\.)?ardmediathek\\.de/.+", "https?://(?:\\w+\\.)?daserste\\.de/.*?\\.html", "https?://(?:www\\.)?sandmann\\.de/.+", "https?://(?:\\w+\\.)?wdr\\.de/[^<>\"]+\\.html|https?://deviceids-[a-z0-9\\-]+\\.wdr\\.de/ondemand/\\d+/\\d+\\.js", "https?://(?:\\w+\\.)?sportschau\\.de/.*?\\.html", "https?://(?:\\w+\\.)?wdrmaus\\.de/.+", "https?://(?:\\w+\\.)?eurovision\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?sputnik\\.de/[^<>\"]+\\.html", "https?://(?:www\\.)?mdr\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?ndr\\.de/[^<>\"]+\\.html", "https?://(?:\\w+\\.)?tagesschau\\.de/[^<>\"]+\\.html" })
7777
public class Ardmediathek extends PluginForDecrypt {
7878
/* Constants */
7979
private static final String type_embedded = "(?i)https?://deviceids-[a-z0-9\\-]+\\.wdr\\.de/ondemand/\\d+/\\d+\\.js";
@@ -678,11 +678,20 @@ private ArrayList<DownloadLink> handleUserQualitySelectionArdmediathek(final Ard
678678
languagePrioString = "deu";
679679
}
680680
final String[] audioPrioList = languagePrioString.toLowerCase(Locale.ENGLISH).replace(" ", "").split(",");
681+
final Map<String, String> audioStringCorrectionMap = new HashMap<String, String>();
682+
audioStringCorrectionMap.put("de", "deu");
683+
audioStringCorrectionMap.put("ger", "deu");
684+
audioStringCorrectionMap.put("deutsch", "deu");
685+
audioStringCorrectionMap.put("en", "eng");
686+
audioStringCorrectionMap.put("english", "eng");
687+
audioStringCorrectionMap.put("englisch", "eng");
688+
audioStringCorrectionMap.put("original", "ov");
689+
audioStringCorrectionMap.put("orig", "ov");
681690
for (String audioPrioString : audioPrioList) {
682-
if (audioPrioString.equals("de")) {
683-
audioPrioString = "deu";
684-
} else if (audioPrioString.equals("original")) {
685-
audioPrioString = "ov";
691+
/* Correct user input to allow for more variations */
692+
final String audioPrioStringCorrected = audioStringCorrectionMap.get(languagePrioString);
693+
if (audioPrioStringCorrected != null) {
694+
audioPrioString = audioPrioStringCorrected;
686695
}
687696
if (audioLanguages.containsKey(audioPrioString)) {
688697
targetAudioLanguageCode = audioPrioString;
@@ -858,9 +867,10 @@ private ArrayList<DownloadLink> crawlSportschauDe(final CryptedLink param) throw
858867
}
859868

860869
/**
861-
* Searches for videos in ardmediathek that match the given search term. </br> This is mostly used as a workaround to find stuff that is
862-
* hosted on their other website on ardmediathek instead as ardmediathek is providing a fairly stable API while other websites hosting
863-
* the same content such as sportschau.de can be complicated to parse. </br> This does not (yet) support pagination!
870+
* Searches for videos in ardmediathek that match the given search term. </br>
871+
* This is mostly used as a workaround to find stuff that is hosted on their other website on ardmediathek instead as ardmediathek is
872+
* providing a fairly stable API while other websites hosting the same content such as sportschau.de can be complicated to parse. </br>
873+
* This does not (yet) support pagination!
864874
*/
865875
private ArrayList<DownloadLink> crawlARDMediathekSearchResultsVOD(final String searchTerm, final int maxResults) throws Exception {
866876
if (StringUtils.isEmpty(searchTerm)) {
@@ -978,8 +988,8 @@ private ArrayList<DownloadLink> crawlWdrMediaObject(final CryptedLink param, fin
978988
}
979989
metadata.setChannel(trackerData.get("trackerClipCategory").toString());
980990
/**
981-
* 2022-03-10: Do not use trackerClipId as unique ID as there can be different IDs for the same streams. </br> Let the handling go
982-
* into fallback and use the final downloadurls as unique trait!
991+
* 2022-03-10: Do not use trackerClipId as unique ID as there can be different IDs for the same streams. </br>
992+
* Let the handling go into fallback and use the final downloadurls as unique trait!
983993
*/
984994
// metadata.setContentID(trackerData.get("trackerClipId").toString());
985995
metadata.setRequiresContentIDToBeSet(false);
@@ -1230,7 +1240,8 @@ private HashMap<String, DownloadLink> crawlARDJson(final CryptedLink param, fina
12301240
}
12311241

12321242
/**
1233-
* Handling for older ARD websites. </br> INFORMATION: network = akamai or limelight == RTMP </br>
1243+
* Handling for older ARD websites. </br>
1244+
* INFORMATION: network = akamai or limelight == RTMP </br>
12341245
*/
12351246
private ArrayList<DownloadLink> crawlDasersteVideo(final CryptedLink param) throws Exception {
12361247
br.getPage(param.getCryptedUrl());

svn_trunk/src/jd/plugins/decrypter/DailyMotionComDecrypter.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import jd.plugins.hoster.DailyMotionCom;
5959

6060
//Decrypts embedded videos from dailymotion
61-
@DecrypterPlugin(revision = "$Revision: 50376 $", interfaceVersion = 2, names = { "dailymotion.com" }, urls = { "https?://(?:www\\.)?(dailymotion\\.com|dai\\.ly)/.+" })
61+
@DecrypterPlugin(revision = "$Revision: 51302 $", interfaceVersion = 2, names = { "dailymotion.com" }, urls = { "https?://(?:www\\.)?(dailymotion\\.com|dai\\.ly)/.+" })
6262
public class DailyMotionComDecrypter extends PluginForDecrypt {
6363
public DailyMotionComDecrypter(PluginWrapper wrapper) {
6464
super(wrapper);
@@ -118,16 +118,16 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressContro
118118
username = profileregex1.getMatch(1);
119119
}
120120
} else {
121-
username = new Regex(param.getCryptedUrl(), "(?i)https?://(?:www\\.)?dailymotion\\.com/([^/]+)$").getMatch(0);
121+
username = new Regex(param.getCryptedUrl(), "(?i)https?://(?:www\\.)?dailymotion\\.com/([^/\\?]+)").getMatch(0);
122122
}
123123
if (contenturl.matches(TYPE_PLAYLIST)) {
124124
return crawlPlaylist(contenturl);
125-
} else if (username != null) {
126-
return crawlUser(username);
127125
} else if (contenturl.matches(TYPE_VIDEO)) {
128126
return crawlSingleVideo(param, contenturl, SubConfiguration.getConfig(this.getHost()), false);
129127
} else if (contenturl.matches(TYPE_USER_SEARCH)) {
130128
return crawlUserSearch(contenturl);
129+
} else if (username != null) {
130+
return crawlUser(username);
131131
} else {
132132
/* This should never happen. */
133133
logger.info("Unsupported linktype: " + contenturl);
@@ -166,6 +166,7 @@ private ArrayList<DownloadLink> crawlUser(final String username) throws Exceptio
166166
fp.setName(username);
167167
boolean has_more = false;
168168
int page = 0;
169+
int numberofVideos = -1;
169170
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
170171
do {
171172
page++;
@@ -179,6 +180,14 @@ private ArrayList<DownloadLink> crawlUser(final String username) throws Exceptio
179180
}
180181
final String json = brc.getRequest().getHtmlCode();
181182
final Map<String, Object> entries = restoreFromString(json, TypeRef.MAP);
183+
if (page == 1) {
184+
/* Init some variables. */
185+
numberofVideos = ((Number) entries.get("total")).intValue();
186+
if (numberofVideos == 0) {
187+
logger.info("Profile contains 0 items");
188+
throw new DecrypterRetryException(RetryReason.EMPTY_FOLDER);
189+
}
190+
}
182191
has_more = ((Boolean) entries.get("has_more")).booleanValue();
183192
final List<Map<String, Object>> list = (List<Map<String, Object>>) entries.get("list");
184193
for (final Map<String, Object> videomap : list) {
@@ -188,7 +197,7 @@ private ArrayList<DownloadLink> crawlUser(final String username) throws Exceptio
188197
ret.add(dl);
189198
distribute(dl);
190199
}
191-
logger.info("Crawled page " + page + " | Items on this page: " + list.size() + " | Found total so far: " + ret.size());
200+
logger.info("Crawled page " + page + " | Items on this page: " + list.size() + " | Found total so far: " + ret.size() + "/" + numberofVideos);
192201
if (this.isAbort()) {
193202
logger.info("Stopping because: Aborted by user");
194203
break;
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
//jDownloader - Downloadmanager
2+
//Copyright (C) 2009 JD-Team support@jdownloader.org
3+
//
4+
//This program is free software: you can redistribute it and/or modify
5+
//it under the terms of the GNU General Public License as published by
6+
//the Free Software Foundation, either version 3 of the License, or
7+
//(at your option) any later version.
8+
//
9+
//This program is distributed in the hope that it will be useful,
10+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
//GNU General Public License for more details.
13+
//
14+
//You should have received a copy of the GNU General Public License
15+
//along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
package jd.plugins.decrypter;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
import java.util.Map;
21+
22+
import org.appwork.storage.TypeRef;
23+
import org.appwork.utils.DebugMode;
24+
import org.appwork.utils.StringUtils;
25+
import org.appwork.utils.parser.UrlQuery;
26+
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperCrawlerPluginRecaptchaV2;
27+
import org.jdownloader.scripting.JavaScriptEngineFactory;
28+
29+
import jd.PluginWrapper;
30+
import jd.controlling.ProgressController;
31+
import jd.http.Browser;
32+
import jd.nutils.encoding.Encoding;
33+
import jd.plugins.Account;
34+
import jd.plugins.AccountRequiredException;
35+
import jd.plugins.CryptedLink;
36+
import jd.plugins.DecrypterPlugin;
37+
import jd.plugins.DownloadLink;
38+
import jd.plugins.FilePackage;
39+
import jd.plugins.LinkStatus;
40+
import jd.plugins.PluginDependencies;
41+
import jd.plugins.PluginException;
42+
import jd.plugins.PluginForDecrypt;
43+
import jd.plugins.hoster.HanimeTv;
44+
45+
@DecrypterPlugin(revision = "$Revision: 51302 $", interfaceVersion = 3, names = {}, urls = {})
46+
@PluginDependencies(dependencies = { HanimeTv.class })
47+
public class HanimeTvCrawler extends PluginForDecrypt {
48+
public HanimeTvCrawler(PluginWrapper wrapper) {
49+
super(wrapper);
50+
}
51+
52+
@Override
53+
public Browser createNewBrowserInstance() {
54+
final Browser br = super.createNewBrowserInstance();
55+
br.setFollowRedirects(true);
56+
return br;
57+
}
58+
59+
public static List<String[]> getPluginDomains() {
60+
return HanimeTv.getPluginDomains();
61+
}
62+
63+
public static String[] getAnnotationNames() {
64+
return buildAnnotationNames(getPluginDomains());
65+
}
66+
67+
@Override
68+
public String[] siteSupportedNames() {
69+
return buildSupportedNames(getPluginDomains());
70+
}
71+
72+
public static String[] getAnnotationUrls() {
73+
return buildAnnotationUrls(getPluginDomains());
74+
}
75+
76+
public static String[] buildAnnotationUrls(final List<String[]> pluginDomains) {
77+
final List<String> ret = new ArrayList<String>();
78+
for (final String[] domains : pluginDomains) {
79+
// See: https://svn.jdownloader.org/issues/89919
80+
if (DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
81+
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/videos/hentai/([a-z0-9\\-]+)");
82+
} else {
83+
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/videos/hentai_TODO_UNFINISHED_PLUGIN/([a-z0-9\\-]+)");
84+
}
85+
}
86+
return ret.toArray(new String[0]);
87+
}
88+
89+
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
90+
if (!DebugMode.TRUE_IN_IDE_ELSE_FALSE) {
91+
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
92+
}
93+
br.getPage(param.getCryptedUrl());
94+
if (br.getHttpConnection().getResponseCode() == 404) {
95+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
96+
}
97+
final String json = br.getRegex("window\\.__NUXT__=(.*?);</script>").getMatch(0);
98+
final Map<String, Object> entries = restoreFromString(json, TypeRef.MAP);
99+
final Map<String, Object> video = (Map<String, Object>) JavaScriptEngineFactory.walkJson(entries, "state/data/video");
100+
final Map<String, Object> hentai_video = (Map<String, Object>) video.get("hentai_video");
101+
final String title = hentai_video.get("name").toString();
102+
final String slug = hentai_video.get("slug").toString();
103+
final String slug_base64_encoded = Encoding.Base64Encode(slug);
104+
final String description = hentai_video.get("description").toString();
105+
final FilePackage fp = FilePackage.getInstance();
106+
fp.setName(Encoding.htmlDecode(title).trim());
107+
fp.setComment(description);
108+
final String downloadlink = "/downloads/" + slug_base64_encoded;
109+
br.getPage(downloadlink);
110+
final String recaptchaV2Response = new CaptchaHelperCrawlerPluginRecaptchaV2(this, br, "6Lcs0SUUAAAAALB-B0yj9Bw0DQFSn0te4l72YrtV").getToken();
111+
/* TODO: Implement signature verification */
112+
final UrlQuery query = new UrlQuery();
113+
query.appendEncoded("id", slug_base64_encoded);
114+
query.appendEncoded("kind", "requestlinks");
115+
query.appendEncoded("captcha_kind", "recaptcha");
116+
query.appendEncoded("captcha_token", recaptchaV2Response);
117+
query.appendEncoded("captcha_expires", "");
118+
query.appendEncoded("loc", "https://hanime.tv");
119+
br.getHeaders().put("Accept", "application/json, text/plain, */*");
120+
br.getHeaders().put("Origin", "https://" + br.getHost());
121+
br.getHeaders().put("x-session-token", "");
122+
br.getHeaders().put("x-signature", "TODO");
123+
br.getHeaders().put("x-signature-version", "web2");
124+
br.getHeaders().put("x-time", Long.toString(System.currentTimeMillis()));
125+
br.getHeaders().put("x-token", "null");
126+
br.getPage("https://h.freeanimehentai.net/rapi/v7/downloads?" + query.toString());
127+
final Map<String, Object> entries2 = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
128+
if (entries2.get("is_downloads_enabled") != Boolean.TRUE) {
129+
throw new AccountRequiredException();
130+
}
131+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
132+
int numberofDownloadableItemsGuest = 0;
133+
// int numberofDownloadableItemsMember = 0;
134+
final Map<String, Object> videos_manifest = (Map<String, Object>) entries2.get("videos_manifest");
135+
final List<Map<String, Object>> servers = (List<Map<String, Object>>) videos_manifest.get("servers");
136+
for (final Map<String, Object> server : servers) {
137+
final List<Map<String, Object>> streams = (List<Map<String, Object>>) server.get("streams");
138+
for (final Map<String, Object> stream : streams) {
139+
if (stream.get("is_downloadable") != Boolean.TRUE) {
140+
logger.info("Skipping undownloadable item: " + stream.get("id"));
141+
continue;
142+
} else if (stream.get("is_guest_allowed") != Boolean.TRUE) {
143+
logger.info("Skipping undownloadable item: " + stream.get("id"));
144+
continue;
145+
}
146+
numberofDownloadableItemsGuest++;
147+
final String url = stream.get("url").toString();
148+
final String filename = stream.get("filename").toString();
149+
final long filesize_mbs = ((Number) stream.get("filesize_mbs")).longValue();
150+
final DownloadLink link = this.createDownloadlink(url);
151+
link.setName(filename);
152+
link.setDownloadSize(filesize_mbs * 1024 * 1024 * 1024);
153+
if (StringUtils.containsIgnoreCase(url, "highwinds-cdn.com")) {
154+
/* Direct downloadable URL */
155+
link.setAvailable(true);
156+
}
157+
link._setFilePackage(fp);
158+
ret.add(link);
159+
}
160+
}
161+
if (numberofDownloadableItemsGuest == 0) {
162+
throw new AccountRequiredException();
163+
}
164+
return ret;
165+
}
166+
167+
@Override
168+
public boolean hasCaptcha(CryptedLink link, Account acc) {
169+
return false;
170+
}
171+
}

0 commit comments

Comments
 (0)