Skip to content

Commit

Permalink
fixed: HD-Url aus normaler Url "erraten"
Browse files Browse the repository at this point in the history
closed #168
  • Loading branch information
alex1702 committed Nov 10, 2017
2 parents 4abc48b + d689423 commit f615e71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ apply from: "${project.rootDir}/gradle/eclipse.gradle"
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'de.mediathekview'
version = '3.1.35'
version = '3.1.36'

def jarName = 'MServer.jar'
def mainClass = 'mServer.Main'
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/mServer/crawler/sender/MediathekArd.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class MediathekArd extends MediathekReader {
private static final String M3U8_PATTERN_END = "\"";
private static final String TEXT_START_HTTP = "http";
private static final String URL_GET_PARAMETER = "\\?.*";
private static final String SUFFIX_URL_NORMAL = "/960-1.mp4";
private static final String SUFFIX_URL_HD = "/1280-1.mp4";

private MSStringBuilder seiteFeed = new MSStringBuilder(Const.STRING_BUFFER_START_BUFFER);

Expand Down Expand Up @@ -378,6 +380,8 @@ private void filmSuchen2(String urlFilm_, String thema, String titel, long dauer
}
if (dto.getUrl(Qualities.HD) != null) {
urlHD = dto.getUrl(Qualities.HD);
} else if (!url.isEmpty()) {
urlHD = determineHdFromNormal(url);
}

if (url.isEmpty()) {
Expand Down Expand Up @@ -455,6 +459,21 @@ private void filmSuchen2(String urlFilm_, String thema, String titel, long dauer
}
}

// Versucht aus der normalen Url eine HD-Url zu bauen
private String determineHdFromNormal(String urlNormal) {
String urlHd = "";

// für URLs, die auf /960-1.mp4 enden, prüfen ob eine URL auf /1280-1.mp4 existiert
if (urlNormal.endsWith(SUFFIX_URL_NORMAL)) {
String urlTemp = urlNormal.replaceAll(SUFFIX_URL_NORMAL, SUFFIX_URL_HD);
if (urlExists(urlTemp)) {
urlHd = urlTemp;
}
}

return urlHd;
}

private String getUrl(MSStringBuilder seite) {
String ret = "";
seite.extractList("\"_quality\":2,\"_stream\":[", "]", liste);
Expand Down

0 comments on commit f615e71

Please sign in to comment.