update date extracting regex pattern + fix some strings in English

This commit is contained in:
chschtsch 2015-11-10 19:50:04 +03:00
parent 586bad345c
commit 224e7a8969
8 changed files with 20 additions and 20 deletions

View file

@ -1,3 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="the-scrabi" />
</component>

View file

@ -3,10 +3,9 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.4" /> <option name="gradleJvm" value="1.7" />
<option name="gradleJvm" value="1.8" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="" />
</component> </component>
</project> </project>

View file

@ -92,12 +92,12 @@
</content> </content>
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="rhino-1.7.7" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" /> <orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
<orderEntry type="library" exported="" name="jsoup-1.8.3" level="project" /> <orderEntry type="library" exported="" name="jsoup-1.8.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" /> <orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="rhino-1.7.7" level="project" />
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
</component> </component>
</module> </module>

View file

@ -37,6 +37,7 @@ public class Downloader {
HttpURLConnection con = (HttpURLConnection) url.openConnection(); HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET"); con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("User-Agent", USER_AGENT);
con.setRequestProperty("Accept-Language", "en");
BufferedReader in = new BufferedReader( BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream())); new InputStreamReader(con.getInputStream()));

View file

@ -288,8 +288,8 @@ public class YoutubeExtractor implements Extractor {
videoInfo.upload_date = doc.select("strong[class=\"watch-time-text\"").first() videoInfo.upload_date = doc.select("strong[class=\"watch-time-text\"").first()
.text(); .text();
// Try to only use date not the text around it // Extracting the date itself from header
videoInfo.upload_date = matchGroup1("([0-9.]*$)", videoInfo.upload_date); videoInfo.upload_date = matchGroup1("([A-Za-z]{3}\\s[\\d]{1,2},\\s[\\d]{4}$)", videoInfo.upload_date);
// description // description
videoInfo.description = doc.select("p[id=\"eow-description\"]").first() videoInfo.description = doc.select("p[id=\"eow-description\"]").first()
@ -320,6 +320,9 @@ public class YoutubeExtractor implements Extractor {
// view count // view count
videoInfo.view_count = doc.select("div[class=\"watch-view-count\"]").first().text(); 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 // next video
videoInfo.nextVideo = extractVideoInfoItem(doc.select("div[class=\"watch-sidebar-section\"]").first() videoInfo.nextVideo = extractVideoInfoItem(doc.select("div[class=\"watch-sidebar-section\"]").first()
.select("li").first()); .select("li").first());

View file

@ -4,7 +4,7 @@
<string name="title_videoitem_detail">NewPipe</string> <string name="title_videoitem_detail">NewPipe</string>
<string name="nothingFound">Nothing found</string> <string name="nothingFound">Nothing found</string>
<string name="viewSufix">views</string> <string name="viewSufix">views</string>
<string name="uploadDatePrefix">Uploaded at: </string> <string name="uploadDatePrefix">Published on </string>
<string name="noPlayerFound">No StreamPlayer found. You may want to install one.</string> <string name="noPlayerFound">No StreamPlayer found. You may want to install one.</string>
<string name="installStreamPlayer">Install one</string> <string name="installStreamPlayer">Install one</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
@ -45,9 +45,9 @@
<item>Video</item> <item>Video</item>
<item>Audio</item> <item>Audio</item>
</string-array> </string-array>
<string name="nextVideoTitle">Next Video</string> <string name="nextVideoTitle">Next video</string>
<string name="showNextAndSimilarTitle">Show next and similar Videos.</string> <string name="showNextAndSimilarTitle">Show next and similar videos</string>
<string name="urlNotSupportedText">Url not Supported.</string> <string name="urlNotSupportedText">URL not supported.</string>
<string name="showSimilarVideosButtonText">Similar Videos</string> <string name="showSimilarVideosButtonText">Similar videos</string>
<string name="contentCountryTitle">Video Content Country</string> <string name="contentCountryTitle">Preferable content location</string>
</resources> </resources>