From bb2955e4421c68aa4e2f13f2fe7666ef7c59b3c3 Mon Sep 17 00:00:00 2001 From: Timofonic Date: Sun, 8 Nov 2015 19:54:10 +0100 Subject: [PATCH 1/5] Translated using Weblate (Spanish) Currently translated at 100.0% (46 of 46 strings) --- app/src/main/res/values-es/strings.xml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index c40c0538a..5d8e8b62e 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1,4 +1,4 @@ - + NewPipe NewPipe @@ -6,17 +6,17 @@ visitas Subido desde: No se ha encontrado ningún reproductor de vídeo. Quizás quieras instalar alguno. - Instalar + Instalarlo Cancelar https://f-droid.org/repository/browse/?fdfilter=vlc&fdid=org.videolan.vlc - Abrir en navegador + Abrir en el navegador Compartir Reproducir Descargar Buscar Ajustes Enviar con - Querias decir: + "¿Querías decir?: " Buscar página: Compartir con: Selecciona navegador: @@ -24,15 +24,26 @@ Ajustes Usar reproductor externo Descargar en... - Donde se guardarán los vídeos descargados. + Ruta donde guardar los vídeos descargados. Localización del directorio de descargas Reproducción automática - Reproduce los vídeos automaticamente cuando la llamada viene de otra aplicación. + Reproducir los vídeos automaticamente cuando se llama desde otra aplicación. Resolución por defecto Reproducir con Kodi Aplicación Kore no encontrada. Kore es necesario para reproducir vídeos con Kodi media center. Instalar Kore https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore Mostrar la opción \"Reproducir con Kodi\" - Muestra una opción para reproducir vídeo vía Kodi media center. + Muestra una opción para reproducir el vídeo con Kodi media center. +Mostrar el botón de reproducir en el lado izquierdo. + Audio + Formato de audio por defecto + WebM - formato libre + m4a - mejor calidad + Descargar + Siguiente vídeo + Mostrar la opción \"Siguiente vídeo\". + Url no soportada. + Vídeos similares + País del contenido del vídeo From 33e332f10562f3e37ee75b3daecad44c69ea9466 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 8 Nov 2015 21:17:51 +0100 Subject: [PATCH 2/5] impofed performance and made similar video button hidable --- .../newpipe/VideoItemDetailFragment.java | 4 + .../newpipe/youtube/YoutubeExtractor.java | 88 +++++++++++++------ app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- app/src/main/res/xml/settings_screen.xml | 6 +- 5 files changed, 71 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java index 94900f20b..aab57e23f 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemDetailFragment.java @@ -127,6 +127,8 @@ public class VideoItemDetailFragment extends Fragment { } @Override public void run() { + //todo: fix expired thread error: + // If the thread calling this runnable is expired, the following function will crash. updateInfo(videoInfo); } } @@ -201,11 +203,13 @@ public class VideoItemDetailFragment extends Fragment { .getViewByVideoInfoItem(null, nextVideoFrame, info.nextVideo); nextVideoFrame.addView(nextVideoView); Button nextVideoButton = (Button) activity.findViewById(R.id.detailNextVideoButton); + Button similarVideosButton = (Button) activity.findViewById(R.id.detailShowSimilarButton); contentMainView.setVisibility(View.VISIBLE); progressBar.setVisibility(View.GONE); if(!showNextVideoItem) { nextVideoRootFrame.setVisibility(View.GONE); + similarVideosButton.setVisibility(View.GONE); } switch (info.videoAvailableStatus) { diff --git a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java index 9cca7feea..e38c7b9c4 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java @@ -91,9 +91,46 @@ public class YoutubeExtractor implements Extractor { } } - private String decryptionCode = ""; + + // static values private static final String DECRYPTION_FUNC_NAME="decrypt"; + // cached values + private static volatile String decryptionCode = ""; + + public void initService(String site) { + // The Youtube service needs to be initialized by downloading the + // js-Youtube-player. This is done in order to get the algorithm + // for decrypting cryptic signatures inside certain stream urls. + + // Star Wars Kid is used as a dummy video, in order to download the youtube player. + //String site = Downloader.download("https://www.youtube.com/watch?v=HPPj6viIBmU"); + //------------------------------------- + // extracting form player args + //------------------------------------- + try { + String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site); + JSONObject jsonObj = new JSONObject(jsonString); + + //---------------------------------- + // load an parse description code + //---------------------------------- + if (decryptionCode.isEmpty()) { + JSONObject ytAssets = jsonObj.getJSONObject("assets"); + String playerUrl = ytAssets.getString("js"); + if (playerUrl.startsWith("//")) { + playerUrl = "https:" + playerUrl; + } + Log.d(TAG, playerUrl); + decryptionCode = loadDecryptionCode(playerUrl); + } + + } catch (Exception e){ + Log.d(TAG, "Could not initialize the extractor of the Youtube service."); + e.printStackTrace(); + } + } + @Override public String getVideoId(String videoUrl) { try { @@ -147,18 +184,18 @@ public class YoutubeExtractor implements Extractor { videoInfo.age_limit = 0; videoInfo.webpage_url = siteUrl; + + initService(site); + //------------------------------------- // extracting form player args //------------------------------------- JSONObject playerArgs = null; - JSONObject ytAssets = null; - String dashManifest; { try { String jsonString = matchGroup1("ytplayer.config\\s*=\\s*(\\{.*?\\});", site); JSONObject jsonObj = new JSONObject(jsonString); playerArgs = jsonObj.getJSONObject("args"); - ytAssets = jsonObj.getJSONObject("assets"); } catch (Exception e) { e.printStackTrace(); @@ -168,7 +205,24 @@ public class YoutubeExtractor implements Extractor { } } + //----------------------- + // load and extract audio + //----------------------- try { + String dashManifest = playerArgs.getString("dashmpd"); + videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode); + + } catch (NullPointerException e) { + Log.e(TAG, "Could not find \"dashmpd\" upon the player args (maybe no dash manifest available)."); + } catch (Exception e) { + e.printStackTrace(); + } + + try { + //-------------------------------------------- + // extract general information about the video + //-------------------------------------------- + videoInfo.uploader = playerArgs.getString("author"); videoInfo.title = playerArgs.getString("title"); //first attempt gating a small image version @@ -176,23 +230,6 @@ public class YoutubeExtractor implements Extractor { videoInfo.thumbnail_url = playerArgs.getString("thumbnail_url"); videoInfo.duration = playerArgs.getInt("length_seconds"); videoInfo.average_rating = playerArgs.getString("avg_rating"); - String playerUrl = ytAssets.getString("js"); - if(playerUrl.startsWith("//")) { - playerUrl = "https:" + playerUrl; - } - if(decryptionCode.isEmpty()) { - decryptionCode = loadDecryptionCode(playerUrl); - } - - // extract audio - try { - dashManifest = playerArgs.getString("dashmpd"); - videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode); - } catch (Exception e) { - //todo: check if the following statement is true - Log.e(TAG, "Dash manifest doesn't seem to be available."); - e.printStackTrace(); - } //------------------------------------ // extract video stream url @@ -211,9 +248,6 @@ public class YoutubeExtractor implements Extractor { // if video has a signature: decrypt it and add it to the url if(tags.get("s") != null) { - if(decryptionCode.isEmpty()) { - decryptionCode = loadDecryptionCode(playerUrl); - } streamUrl = streamUrl + "&signature=" + decryptSignature(tags.get("s"), decryptionCode); } @@ -231,9 +265,9 @@ public class YoutubeExtractor implements Extractor { e.printStackTrace(); } - //------------------------------- - // extracting from html page - //------------------------------- + //--------------------------------------- + // extracting information from html page + //--------------------------------------- // Determine what went wrong when the Video is not available diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 32d9f984a..2a397a786 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -46,7 +46,7 @@ Audio Nächstes Video - Zeige \"Nächstes Video\" Auswahl. + Zeige nächstes und änliche Videos. Url wird nicht unterstützt. Ähnliche Videos \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7fafc3104..41f6b5530 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -46,7 +46,7 @@ Audio Next Video - Show \"Next video\" item. + Show next and similar Videos. Url not Supported. Similar Videos Video Content Country diff --git a/app/src/main/res/xml/settings_screen.xml b/app/src/main/res/xml/settings_screen.xml index bee161060..180b226a3 100644 --- a/app/src/main/res/xml/settings_screen.xml +++ b/app/src/main/res/xml/settings_screen.xml @@ -48,13 +48,15 @@ + + android:defaultValue="" /> + --> \ No newline at end of file From 696760e65a6346626a4c650a9266f6ef854d1808 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 8 Nov 2015 21:22:24 +0100 Subject: [PATCH 3/5] removed printing the player url --- .../main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java index e38c7b9c4..8ba344361 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java @@ -121,7 +121,6 @@ public class YoutubeExtractor implements Extractor { if (playerUrl.startsWith("//")) { playerUrl = "https:" + playerUrl; } - Log.d(TAG, playerUrl); decryptionCode = loadDecryptionCode(playerUrl); } From aee32f7a3e300aa3fe9b6471ce9e45df349e7bdf Mon Sep 17 00:00:00 2001 From: jasperweiss Date: Mon, 9 Nov 2015 08:16:28 +0100 Subject: [PATCH 4/5] Translated using Weblate (Dutch) Currently translated at 100.0% (46 of 46 strings) --- app/src/main/res/values-nl/strings.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a2efb7ae1..8e4f26840 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -5,7 +5,7 @@ Geen resultaten keer bekeken Geüpload op: - Geen speler met streaming ondersteuning gevonden. Je wilt er misschien een installeren. + Geen speler met streaming ondersteuning gevonden. Misschien wil je er een installeren Installeer speler Annuleer https://f-droid.org/repository/browse/?fdfilter=vlc&fdid=org.videolan.vlc @@ -35,4 +35,15 @@ https://f-droid.org/repository/browse/?fdfilter=Kore&fdid=org.xbmc.kore Toon \"Speel af met Kodi\" optie Toont een optie om een video op een Kodi media center af te spelen. - +Video inhoud land +Afspeel knop aan de linker kant weergeven + Audio + Standaard audio formaat + Webam - open formaat + m4a - betere kwaliteit + Download + Volgende video + \"Volgende video\" weergeven + Url wordt niet ondersteund + Vergelijkbare videos + From abdd7dc7d3cfb067087f4c3b877d5febb0bc442d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sz=C3=B6ll=C5=91si=20Attila?= Date: Sun, 8 Nov 2015 17:16:35 +0100 Subject: [PATCH 5/5] Translated using Weblate (Hungarian) Currently translated at 97.8% (45 of 46 strings) --- app/src/main/res/values-hu/strings.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index e2934c4e7..d95ebf03a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -48,4 +48,5 @@ Következő videó \"Következő videó\" elem mutatása A webcím nem támogatott. - +Hasonló videók +