From 224e7a89695ade2ee03f4d5464d4d32081adc7ee Mon Sep 17 00:00:00 2001 From: chschtsch Date: Tue, 10 Nov 2015 19:50:04 +0300 Subject: [PATCH] update date extracting regex pattern + fix some strings in English --- .idea/dictionaries/the_scrabi.xml | 3 --- .idea/gradle.xml | 5 ++--- .idea/misc.xml | 2 +- .idea/vcs.xml | 2 +- app/app.iml | 8 ++++---- app/src/main/java/org/schabi/newpipe/Downloader.java | 1 + .../org/schabi/newpipe/youtube/YoutubeExtractor.java | 7 +++++-- app/src/main/res/values/strings.xml | 12 ++++++------ 8 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 .idea/dictionaries/the_scrabi.xml diff --git a/.idea/dictionaries/the_scrabi.xml b/.idea/dictionaries/the_scrabi.xml deleted file mode 100644 index bc8411615..000000000 --- a/.idea/dictionaries/the_scrabi.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index bd4202cb3..1bbc21dc2 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -3,10 +3,9 @@ - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7f4..6564d52db 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index 58221a4e6..eefc8deb7 100644 --- a/app/app.iml +++ b/app/app.iml @@ -92,12 +92,12 @@ + + + + - - - - \ No newline at end of file diff --git a/app/src/main/java/org/schabi/newpipe/Downloader.java b/app/src/main/java/org/schabi/newpipe/Downloader.java index edf839ac2..43dcc6c41 100644 --- a/app/src/main/java/org/schabi/newpipe/Downloader.java +++ b/app/src/main/java/org/schabi/newpipe/Downloader.java @@ -37,6 +37,7 @@ public class Downloader { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", USER_AGENT); + con.setRequestProperty("Accept-Language", "en"); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); 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 8ba344361..3c659306b 100644 --- a/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/youtube/YoutubeExtractor.java @@ -288,8 +288,8 @@ public class YoutubeExtractor implements Extractor { videoInfo.upload_date = doc.select("strong[class=\"watch-time-text\"").first() .text(); - // Try to only use date not the text around it - videoInfo.upload_date = matchGroup1("([0-9.]*$)", videoInfo.upload_date); + // Extracting the date itself from header + videoInfo.upload_date = matchGroup1("([A-Za-z]{3}\\s[\\d]{1,2},\\s[\\d]{4}$)", videoInfo.upload_date); // description videoInfo.description = doc.select("p[id=\"eow-description\"]").first() @@ -320,6 +320,9 @@ public class YoutubeExtractor implements Extractor { // view count videoInfo.view_count = doc.select("div[class=\"watch-view-count\"]").first().text(); + // Extract view count from header + videoInfo.view_count = matchGroup1("([\\d]*$)", videoInfo.view_count); + // next video videoInfo.nextVideo = extractVideoInfoItem(doc.select("div[class=\"watch-sidebar-section\"]").first() .select("li").first()); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 41f6b5530..2ad31ef9c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,7 +4,7 @@ NewPipe Nothing found views - Uploaded at: + Published on No StreamPlayer found. You may want to install one. Install one Cancel @@ -45,9 +45,9 @@ Video Audio - Next Video - Show next and similar Videos. - Url not Supported. - Similar Videos - Video Content Country + Next video + Show next and similar videos + URL not supported. + Similar videos + Preferable content location \ No newline at end of file