diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e30920404..323da8bd6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -49,6 +49,7 @@
+
diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java
index 78047398d..291244f37 100644
--- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java
+++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java
@@ -50,6 +50,16 @@ import java.util.Vector;
public class YoutubeStreamExtractor implements StreamExtractor {
+ // Sometimes if the html page of youtube is already downloaded, youtube web page will internally
+ // download the /get_video_info page. Since a certain date dashmpd url is only available over
+ // this /get_video_info page, so we always need to download this one to.
+ // %%video_id%% will be replaced by the actual video id
+ // $$el_type$$ will be replaced by the actual el_type (se the declarations below)
+ private static final String GET_VIDEO_INFO_URL =
+ "https://www.youtube.com/get_video_info?video_id=%%video_id%%$$el_type$$&ps=default&eurl=&gl=US&hl=en";
+ // eltype is nececeary for the url aboth
+ private static final String EL_INFO = "el=info";
+
public enum ItagType {
AUDIO,
VIDEO,
@@ -131,16 +141,6 @@ public class YoutubeStreamExtractor implements StreamExtractor {
throw new ParsingException("itag=" + Integer.toString(itag) + " not supported");
}
- // Sometimes if the html page of youtube is already downloaded, youtube web page will internally
- // download the /get_video_info page. Since a certain date dashmpd url is only available over
- // this /get_video_info page, so we always need to download this one to.
- // %%video_id%% will be replaced by the actual video id
- // $$el_type$$ will be replaced by the actual el_type (se the declarations below)
- private static final String GET_VIDEO_INFO_URL =
- "https://www.youtube.com/get_video_info?video_id=%%video_id%%$$el_type$$&ps=default&eurl=&gl=US&hl=en";
- // eltype is nececeary for the url aboth
- private static final String EL_INFO = "el=info";
-
public class DecryptException extends ParsingException {
DecryptException(Throwable cause) {
super(cause);
@@ -163,7 +163,7 @@ public class YoutubeStreamExtractor implements StreamExtractor {
private static final String TAG = YoutubeStreamExtractor.class.toString();
private final Document doc;
private JSONObject playerArgs;
- private Map videoInfoPage;
+ //private Map videoInfoPage;
// static values
private static final String DECRYPTION_FUNC_NAME="decrypt";
@@ -206,6 +206,9 @@ public class YoutubeStreamExtractor implements StreamExtractor {
}
+ /* not yet nececeary
+
+
// get videoInfo page
try {
//Parser.unescapeEntities(url_data_str, true).split("&")
@@ -215,6 +218,7 @@ public class YoutubeStreamExtractor implements StreamExtractor {
} catch(Exception e) {
throw new ParsingException("Could not load video info page.", e);
}
+ */
//----------------------------------
// load and parse description code, if it isn't already initialised
@@ -337,24 +341,6 @@ public class YoutubeStreamExtractor implements StreamExtractor {
@Override
public String getDashMpdUrl() throws ParsingException {
/*
- try {
- String dashManifest = playerArgs.getString("dashmpd");
- if(!dashManifest.contains("/signature/")) {
- String encryptedSig = Parser.matchGroup1("/s/([a-fA-F0-9\\.]+)", dashManifest);
- String decryptedSig;
-
- decryptedSig = decryptSignature(encryptedSig, decryptionCode);
- dashManifest = dashManifest.replace("/s/" + encryptedSig, "/signature/" + decryptedSig);
- }
-
- return dashManifest;
- } catch(JSONException je) {
- throw new ParsingException(
- "Could not find \"dashmpd\" upon the player args (maybe no dash manifest available).", je);
- } catch (Exception e) {
- throw new ParsingException(e);
- }
- */
try {
String dashManifestUrl = videoInfoPage.get("dashmpd");
if(!dashManifestUrl.contains("/signature/")) {
@@ -369,6 +355,8 @@ public class YoutubeStreamExtractor implements StreamExtractor {
throw new ParsingException(
"Could not get \"dashmpd\" maybe VideoInfoPage is broken.", e);
}
+ */
+ return "";
}
diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java
index 7e1786a5b..64b72d08c 100644
--- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java
+++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java
@@ -1,9 +1,15 @@
package org.schabi.newpipe.crawler.services.youtube;
+import android.util.Log;
+
import org.schabi.newpipe.crawler.Parser;
import org.schabi.newpipe.crawler.ParsingException;
import org.schabi.newpipe.crawler.VideoUrlIdHandler;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Map;
+
/**
* Created by Christian Schabesberger on 02.02.16.
*
@@ -34,20 +40,29 @@ public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler {
@SuppressWarnings("WeakerAccess")
@Override
public String getVideoId(String url) throws ParsingException {
- String id;
- String pat;
+ String id = "";
if(url.contains("youtube")) {
- pat = "youtube\\.com/watch\\?v=([\\-a-zA-Z0-9_]{11})";
+ if(url.contains("attribution_link")) {
+ try {
+ String escapedQuery = Parser.matchGroup1("u=(.[^&|$]*)", url);
+ String query = URLDecoder.decode(escapedQuery, "UTF-8");
+ id = Parser.matchGroup1("v=([\\-a-zA-Z0-9_]{11})", query);
+ } catch(UnsupportedEncodingException uee) {
+ throw new ParsingException("Could not parse attribution_link", uee);
+ }
+ } else {
+ id = Parser.matchGroup1("youtube\\.com/watch\\?v=([\\-a-zA-Z0-9_]{11})", url);
+ }
}
else if(url.contains("youtu.be")) {
- pat = "youtu\\.be/([a-zA-Z0-9_-]{11})";
+ id = Parser.matchGroup1("youtu\\.be/([a-zA-Z0-9_-]{11})", url);
}
else {
throw new ParsingException("Error no suitable url: " + url);
}
- id = Parser.matchGroup1(pat, url);
+
if(!id.isEmpty()){
//Log.i(TAG, "string \""+url+"\" matches!");
return id;
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 2db2d7721..d495ae4c8 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -56,7 +56,7 @@
Benutze TOR
Erzwinge das Herunterladen durch TOR für verbesserte Privatsphäre (Videostream noch nicht unterstützt)
-NewPipe Hintergrundwiedergabe
+ NewPipe Hintergrundwiedergabe
Netzwerkfehler
Downloadverzeichnis für Musik
@@ -71,7 +71,7 @@
Andere
Kann Downloadverzeichnis nicht anlegen \'%1$s\'
Downloadverzeichnis \'%1$s\' erstellt
-Fehler
+ Fehler
Konnte nicht alle Vorschaubilder laden
Konnte Video-URL-Signatur nicht entschlüsseln.
Konnte Webseite nicht parsen.