1
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-09-20 23:00:50 +02:00

Compare commits

...

111 Commits

Author SHA1 Message Date
Christian Schabesberger
92db9cb59b update support lib and move on to 0.8.7 2017-01-04 17:20:01 +01:00
Benoît Mauduit
410c4ca736 Remove old comment 2017-01-03 14:38:22 +01:00
Benoît Mauduit
80c9dbf180 Cosmetic 2017-01-03 14:38:22 +01:00
Benoît Mauduit
c9edac2820 Change the way to start reCaptchaActivity
* Use startActivityForResult() and onActivityResult() to refresh the
  search request when returning from reCaptcha activity.
2017-01-03 14:38:22 +01:00
Benoît Mauduit
143df9a529 Start reCaptcha activity when starting video directly 2017-01-03 14:38:22 +01:00
Benoît Mauduit
c87da9903f Set result code and finish() Activity instead of starting MainActivity
* Activities will start reCaptchaActivity with startActivityForResult and
look for RECAPTCHA_REQUEST and RESULT_OK | RESULT_CANCELED in : 'onActivityResult()'
2017-01-03 14:38:22 +01:00
Andi Saputro
0f69e6c64d Translated using Weblate (Indonesian)
Currently translated at 100.0% (140 of 140 strings)
2016-12-31 18:45:16 +01:00
andideveloper
999efb6660 Translated using Weblate (Indonesian)
Currently translated at 100.0% (140 of 140 strings)
2016-12-29 17:25:23 +01:00
Weblate
0b391a9ef3 Merge remote-tracking branch 'origin/master' 2016-12-28 12:46:32 +01:00
naofum
2a99ac4430 Translated using Weblate (Japanese)
Currently translated at 100.0% (140 of 140 strings)
2016-12-28 12:46:22 +01:00
Christian Schabesberger
a5589d0865 Merge branch 'feature-background-progress' of git://github.com/coffeemakr/NewPipe into coffeemakr-feature-background-progress 2016-12-28 10:46:38 +01:00
Coffeemakr
83541a0d5d Add 8dp margin on the right side of the progress bar 2016-12-28 08:15:12 +01:00
Coffeemakr
ac0dff7aa1 Make shure thread quits before service 2016-12-27 16:17:59 +01:00
Coffeemakr
f22b5157f5 Notify thread on play/pause 2016-12-27 15:58:17 +01:00
Coffeemakr
659d0d6115 Add PlaybackState broadcast messages
They can be used to retrieve the current playback
 * Duration
 * Played time
 * If the media player is playing
2016-12-27 15:52:02 +01:00
Marian Hanzel
fd8c99fd8d Translated using Weblate (Slovak)
Currently translated at 100.0% (140 of 140 strings)
2016-12-27 15:47:58 +01:00
Coffeemakr
9494f3a299 Add progress bar to expanded notification 2016-12-27 14:49:59 +01:00
Coffeemakr
8021848b03 Remove note field completly
Always use noteBuilder directly to generate a notification
2016-12-27 14:41:30 +01:00
Coffeemakr
5a127c26e6 Improve notification building/updateing
* Use custom notification builder which has methods to set the artist
  and title and also a method to set the playing state
* Update builder instead of view -> resovles deprecated warnings
2016-12-27 14:37:18 +01:00
Coffeemakr
a7d734c20c Ignore vim's temporary files 2016-12-27 13:32:03 +01:00
Coffeemakr
7c7129f9a1 Notifications: Set customs views in builder 2016-12-27 13:31:34 +01:00
Coffeemakr
05cbc7891d Typos corrected in StreamInfo 2016-12-27 13:26:48 +01:00
Coffeemakr
14623456ff Correct typos 2016-12-27 13:19:12 +01:00
Coffeemakr
5064ec3ac4 Fix spelling 2016-12-27 13:16:51 +01:00
Gian Maria Viglianti
892888796d Translated using Weblate (Italian)
Currently translated at 100.0% (140 of 140 strings)
2016-12-26 14:57:31 +01:00
Weblate
4f2826d2c2 Merge remote-tracking branch 'origin/master' 2016-12-26 10:23:57 +01:00
YFdyh000
7f824d725b Translated using Weblate (Chinese (Simplified))
Currently translated at 98.5% (138 of 140 strings)
2016-12-26 10:23:56 +01:00
naofum
da4096c4ef Translated using Weblate (Japanese)
Currently translated at 100.0% (140 of 140 strings)
2016-12-26 10:23:55 +01:00
Christian Schabesberger
1aed11c156 change ip address provider
removed null bomb
2016-12-25 19:32:38 +01:00
Christian Schabesberger
e99e944ac3 make share with newpipe part of newpipe 2016-12-25 19:28:40 +01:00
Christian Schabesberger
6e523d37ba add copyright notice to DownloadListener 2016-12-25 15:24:37 +01:00
Christian Schabesberger
2aebf6b522 Merge branch 'master' of git://github.com/fr3ts0n/NewPipe into fr3ts0n-master 2016-12-25 15:20:31 +01:00
Mladen Pejaković
3f740980a3 Translated using Weblate (Serbian)
Currently translated at 100.0% (140 of 140 strings)
2016-12-25 14:16:58 +01:00
Weblate
66b73d1592 Merge remote-tracking branch 'origin/master' 2016-12-25 12:44:13 +01:00
RACER
be4b03b84b Translated using Weblate (Japanese)
Currently translated at 100.0% (138 of 138 strings)
2016-12-25 12:44:13 +01:00
Osoitz
3594037efe Translated using Weblate (Basque)
Currently translated at 34.0% (47 of 138 strings)
2016-12-25 12:44:11 +01:00
Christian Schabesberger
38c5cb50fb fixed Downloader.getInstance() in unit tests 2016-12-24 17:11:29 +01:00
Christian Schabesberger
3767a96e0f moved on to version 0.8.6 2016-12-24 16:06:24 +01:00
Christian Schabesberger
937a387f4e rename reCaptchaException to ReCaptchaException 2016-12-24 15:19:40 +01:00
Christian Schabesberger
cd65f1dffc Merge branch 'reCaptcha' of git://github.com/be-neth/NewPipe into be-neth-reCaptcha 2016-12-24 14:13:12 +01:00
Christian Schabesberger
d4e6856cbe Merge pull request #394 from ngoisaosang/master
Try to fix accept SDK Licenses
2016-12-24 14:12:36 +01:00
ngoisaosang
f61d779108 Try to fix travis 2016-12-24 07:25:27 +07:00
ngoisaosang
b8b22d4d91 Fix travis 2016-12-23 13:47:20 +07:00
ngoisaosang
25d0e39736 Update gradle 2016-12-22 22:45:42 +07:00
ngoisaosang
79a9497e65 Fix travis build 2016-12-22 17:40:01 +07:00
Christian Schabesberger
c55dcccb1e Merge branch 'fix-channel-bannel-url' of git://github.com/coffeemakr/NewPipe into coffeemakr-fix-channel-bannel-url 2016-12-21 21:01:47 +01:00
Christian Schabesberger
820e606719 fix duration_background name 2016-12-21 21:00:05 +01:00
Christian Schabesberger
96291a8522 Merge branch 'coffeemakr-fix-yt-dublicated-result-page' 2016-12-21 20:56:40 +01:00
Christian Schabesberger
e7b52bd3b0 Merge pull request #392 from ksyko/patch-1
Fixes spelling
2016-12-21 20:42:03 +01:00
ksyko
dd3251c08d Fixes spelling 2016-12-21 20:38:51 +05:30
Coffeemakr
f4aabdd9b8 Accept SDK Licenses 2016-12-19 19:40:28 +01:00
Coffeemakr
cb1fe5f017 Try to fix travis 2016-12-19 19:36:24 +01:00
Coffeemakr
83837bde11 Google begins with page 1 so we add 1 to our page starting with 0 2016-12-19 19:28:16 +01:00
Coffeemakr
05189dadbf Fix banner extaction 2016-12-19 13:32:03 +01:00
Selim
dbb1f371b3 Translated using Weblate (Turkish)
Currently translated at 94.2% (130 of 138 strings)
2016-12-13 21:46:13 +01:00
Benoît Mauduit
5cc1bbc4bb Add missing Override decorator 2016-12-07 22:26:54 +01:00
Benoît Mauduit
53796043c3 Start reCaptchaActivity when reCaptcha is requested and fix Typo
* Fix typo setSearchWorkerResultListner to setSearchWorkerResultListener
2016-12-07 22:26:54 +01:00
Benoît Mauduit
a5ac528c02 Add reCaptchaException 2016-12-07 22:26:54 +01:00
Benoît Mauduit
54eb353d0d Add ReCaptcha Activity
* ReCaptchas are implemented using a simple WebView with Javascript enable.

 * All HTTP responses inside the WebView are catched (using onPageFinished())
 ** When Google reCatcha cookies are detected, register cookies to the
    Downloader class and Return to MainActivity
2016-12-07 22:26:54 +01:00
Benoît Mauduit
3391067cab Adding cookies member to Downloader 2016-12-07 22:26:54 +01:00
Benoît Mauduit
b4f595eb75 Make Downloader class a Singleton 2016-12-07 22:26:54 +01:00
Weblate
58bc0c17d0 Merge remote-tracking branch 'origin/master' 2016-12-02 10:24:55 +01:00
Cyxae Dexyc
4385404ad6 Translated using Weblate (French)
Currently translated at 98.5% (136 of 138 strings)
2016-12-02 10:24:54 +01:00
Marian Hanzel
61aadcffd2 Translated using Weblate (Slovak)
Currently translated at 100.0% (138 of 138 strings)
2016-12-02 10:24:52 +01:00
Christian Schabesberger
f575826394 fix unit tests 2016-11-20 19:01:06 +01:00
Christian Schabesberger
389959dd18 Merge pull request #366 from coffeemakr/delete-swiss-high-german
Delete Swiss High German translation
2016-11-20 15:43:37 +01:00
Christian Schabesberger
af4734eee3 update to sdk version 25 2016-11-18 23:56:08 +01:00
Christian Schabesberger
f76b37ec39 Merge branch 'master' of github.com:TeamNewPipe/NewPipe 2016-11-18 23:52:34 +01:00
Christian Schabesberger
379149fe2f update unit tests so it works with current updates 2016-11-18 23:52:17 +01:00
Christian Schabesberger
3bd477631c fixed spelling error 2016-11-18 22:08:53 +01:00
Freddy Morán Jr
72c0987bad Translated using Weblate (Spanish)
Currently translated at 100.0% (138 of 138 strings)
2016-11-10 03:46:02 +01:00
fr3ts0n
5bba8e02a6 add media scanner notification after successful download 2016-11-06 21:08:57 +01:00
Freddy Morán Jr
b270de3335 Translated using Weblate (Spanish)
Currently translated at 100.0% (138 of 138 strings)
2016-11-03 21:46:25 +01:00
Freddy Morán Jr
e22bcf0ac5 Translated using Weblate (Serbian)
Currently translated at 100.0% (138 of 138 strings)
2016-11-03 21:46:13 +01:00
Freddy Morán Jr
c1d55d828f Translated using Weblate (Portuguese)
Currently translated at 100.0% (138 of 138 strings)
2016-11-03 21:45:51 +01:00
Freddy Morán Jr
da77970328 Translated using Weblate (Indonesian)
Currently translated at 100.0% (138 of 138 strings)
2016-11-03 21:45:12 +01:00
Freddy Morán Jr
32f3caaee0 Translated using Weblate (German)
Currently translated at 100.0% (138 of 138 strings)
2016-11-03 21:44:57 +01:00
Дима Гайнуллин
8bbacb1d78 Translated using Weblate (Russian)
Currently translated at 88.4% (122 of 138 strings)
2016-11-03 18:45:52 +01:00
Nathan Follens
5904510410 Translated using Weblate (Dutch)
Currently translated at 100.0% (138 of 138 strings)
2016-10-30 00:44:27 +02:00
Enol P
e16624251b Translated using Weblate (Asturian)
Currently translated at 97.1% (134 of 138 strings)
2016-10-21 03:44:09 +02:00
zmni
389f22a0e5 Translated using Weblate (Indonesian)
Currently translated at 99.2% (137 of 138 strings)
2016-10-16 12:45:00 +02:00
zmni
7b91aa16b6 Translated using Weblate (Indonesian)
Currently translated at 95.6% (132 of 138 strings)
2016-10-13 21:45:17 +02:00
Jona Abdinghoff
89ec688632 Translated using Weblate (German)
Currently translated at 99.2% (137 of 138 strings)
2016-10-12 00:44:52 +02:00
Nathan Follens
fdd0d586c9 Translated using Weblate (Dutch)
Currently translated at 99.2% (137 of 138 strings)
2016-10-12 00:44:25 +02:00
Coffeemakr
6f5604791f Delete swiss high german 2016-10-11 07:30:18 +02:00
Gian Maria Viglianti
eb9fba4147 Translated using Weblate (Italian)
Currently translated at 100.0% (138 of 138 strings)
2016-10-10 18:45:06 +02:00
Weblate
afb62f729f Merge remote-tracking branch 'origin/master' 2016-10-04 15:45:09 +02:00
Nathan Follens
1ccc23dc9c Translated using Weblate (Dutch)
Currently translated at 68.8% (95 of 138 strings)
2016-10-04 15:45:07 +02:00
intrnl
7ea5cb9c5c Translated using Weblate (Indonesian)
Currently translated at 37.6% (52 of 138 strings)
2016-10-04 15:44:59 +02:00
Christian Schabesberger
c301d6e5d5 Merge branch 'master' of github.com:TeamNewPipe/NewPipe 2016-10-01 23:22:18 +02:00
naofum
44ad69b94d Translated using Weblate (Japanese)
Currently translated at 100.0% (138 of 138 strings)
2016-10-01 18:45:10 +02:00
Christian Schabesberger
d14515ab88 Merge remote-tracking branch 'origin/master' 2016-09-28 17:13:23 +02:00
Christian Schabesberger
01875b389d clean up extractor 2016-09-28 17:13:15 +02:00
Christian Schabesberger
5eef116aaa put Suggestion extraction into its own class 2016-09-28 12:53:23 +02:00
Weblate
442220debc Merge remote-tracking branch 'origin/master' 2016-09-28 12:45:55 +02:00
kamadi
4914caad51 Translated using Weblate (Russian)
Currently translated at 48.5% (67 of 138 strings)
2016-09-28 12:45:54 +02:00
Gian Maria Viglianti
08cab863f1 Translated using Weblate (Italian)
Currently translated at 98.5% (136 of 138 strings)
2016-09-28 12:45:54 +02:00
Marian Hanzel
02458d4fc1 Translated using Weblate (Slovak)
Currently translated at 98.5% (136 of 138 strings)
2016-09-28 12:45:51 +02:00
Christian Schabesberger
6ed4130b66 fix collisions 2016-09-28 11:54:35 +02:00
Felix Ableitner
5f7ee15d1e Launch video player in single task mode (fixes #154) 2016-09-28 13:09:42 +09:00
Christian Schabesberger
43afd5a2b8 clean up downloader thing 2016-09-27 22:59:04 +02:00
Christian Schabesberger
f9ac199c1f fixed .webm download locatiion issue 2016-09-27 21:33:26 +02:00
Christian Schabesberger
920c169d55 update CI batch in README 2016-09-27 20:22:01 +02:00
Christian Schabesberger
76ba2824a2 stability improvements 2016-09-27 20:18:41 +02:00
Christian Schabesberger
ca0d594547 cleaning away android stuff from extractor 2016-09-27 20:06:33 +02:00
Christian Schabesberger
44b6d900f0 Merge branch 'master' of github.com:TeamNewPipe/NewPipe 2016-09-27 14:58:54 +02:00
Christian Schabesberger
3b2c0186aa update issue teamplate 2016-09-27 14:58:46 +02:00
Christian Schabesberger
efa605700d update contributions link in the readme 2016-09-27 14:33:30 +02:00
Christian Schabesberger
cac360d37b add .github folder 2016-09-27 14:30:03 +02:00
Christian Schabesberger
75e28893fb update contribution guidelines once again 2016-09-27 14:14:59 +02:00
Christian Schabesberger
360a44b5a0 update contribution guidelines 2016-09-27 13:43:43 +02:00
96 changed files with 3420 additions and 869 deletions

36
.github/CONTRIBUTING.md vendored Normal file
View File

@@ -0,0 +1,36 @@
NewPipe contribution guidelines
===============================
READ THIS GUIDELINES CAREFULLY BEFORE CONTRIBUTING.
## Crash reporting
Do not report crashes in the GitHub issue tracker. NewPipe has an automated crash report system that will ask you to send a report if a crash occures.
## Issue reporting/feature request
* Search the [existing issues](https://github.com/theScrabi/NewPipe/issues) first to make sure your issue/feature hasn't been reported/requested before
* Check if this issue/feature is already fixed/implemented in the repository
* If you are an android/java developer you are always welcome to fix/implement an issue/a feature yourself
## Translation
* NewPipe can be translated on [weblate](https://hosted.weblate.org/projects/newpipe/strings/)
## Code contribution
* Stick to NewPipe style guidelines (just look the other code and than do it the same way :) )
* Do not bring nonfree software/binary blobs into the project (keep it google free)
* Stick to [f-droid contribution guidelines](https://f-droid.org/wiki/page/Inclusion_Policy)
* Make changes on a separate branch, not on the master branch (Feature-branching)
* When submitting changes, you agree that your code will be licensed under GPLv3
* Please test (compile and run) your code before you submit changes!!!
* Try to figure out you selves why CI fails, or why a merge request collides
* Please maintain your code after you contributed it.
* Respond yourselves if someone request changes or notifies issues
## Communication
* I hereby declare our Slack channel as dead!!! There are no plans on building a new chat, but if there is interest on creating one and keeping it alive, I'd be pleased to create one again.
* If you want to get in contact with me or one of our other contributors you can send me an email at tnp(at)schabi.org
* Feel free to post suggestions, changes, ideas etc!

2
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,2 @@
- [ ] I carefully read the [contribution guidelines](https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md) and agree to them.
- [ ] I checked if the issue/feature exists in the latest version.

1
.github/PULL_REQUEST_TEAMPLATE.md vendored Normal file
View File

@@ -0,0 +1 @@
[ ] I carefully reed the [contribution guidelines](https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md) and agree to them.

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@
/.idea
/*.iml
gradle.properties
*~

View File

@@ -8,11 +8,12 @@ android:
- build-tools-23.0.3
# The SDK version used to compile NewPipe
- android-24
- android-25
# Additional components
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository
# Emulators
- sys-img-armeabi-v7a-android-21
@@ -33,3 +34,7 @@ before_script:
- adb shell input keyevent 82 &
script: ./gradlew --info build connectedCheck
licenses:
- '.+'

View File

@@ -1,33 +0,0 @@
#Contribution
This document contains guidelines on making contributions to NewPipe.
## Programming
* Follow the [Google Style Guidelines](https://google.github.io/styleguide/javaguide.html)
* Make a new feature on a separate branch, not on the master branch
* Make a [pull request](https://github.com/theScrabi/NewPipe/pulls) if you're done with your changes
* When submitting changes, you agree that your code will be GPLv3 licensed
## Commit messages
* The subject line of your commit message shouldn't be longer than 72 characters
* Try to keep each line of your commit message 72 characters to ensure proper
compatibility with all git tools
* [This guide](http://chris.beams.io/posts/git-commit/) goes more in depth on what makes a good commit message
## Translation
* NewPipe can be translated on [weblate](https://hosted.weblate.org/projects/newpipe/strings/)
## Issue reporting
* Search the [existing issues](https://github.com/theScrabi/NewPipe/issues) first to make sure your issue hasn't been reported before
* Check if this issue is already fixed in the repository
* When making bug reports, be sure to tell which version of NewPipe you are using and the steps to reproduce the problem
* Please include a log if you can
## Communication
* For the time being, [Slack](https://newpipe.slack.com/) is being used for project communication. Ask [me](https://github.com/theScrabi) to sign up.
* Feel free to post suggestions, changes, ideas etc!

View File

@@ -9,7 +9,7 @@ NewPipe: A free lightweight Youtube frontend for Android.
Project status:
[![Translation Status](https://hosted.weblate.org/widgets/NewPipe/-/svg-badge.svg)](https://hosted.weblate.org/engage/NewPipe/)
[![Build Status](https://travis-ci.org/theScrabi/NewPipe.svg)](https://travis-ci.org/theScrabi/NewPipe)
[![Build Status](https://travis-ci.org/TeamNewPipe/NewPipe.svg)](https://travis-ci.org/TeamNewPipe/NewPipe)
## Donate
![Bitcoin](https://bitcoin.org/img/icons/logotop.svg)
@@ -64,7 +64,7 @@ Although NewPipe only supports YouTube at the moment, it's designed to support m
Whether you have ideas, translation, design changes, code cleaning, or real heavy code changes, help is always welcome.
The more is done the better it gets!
If you'd like to get involved, check our [contribution notes](CONTRIBUTING.md).
If you'd like to get involved, check our [contribution notes](.github/CONTRIBUTING.md).
## License
[![GNU GPLv3 Image](https://www.gnu.org/graphics/gplv3-127x51.png)](http://www.gnu.org/licenses/gpl-3.0.en.html)

View File

@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
compileSdkVersion 25
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "org.schabi.newpipe"
minSdkVersion 15
targetSdkVersion 24
versionCode 19
versionName "0.8.5"
targetSdkVersion 25
versionCode 21
versionName "0.8.7"
}
buildTypes {
release {
@@ -32,10 +32,10 @@ android {
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'org.jsoup:jsoup:1.8.3'
compile 'org.mozilla:rhino:1.7.7'
compile 'info.guardianproject.netcipher:netcipher:1.2'

View File

@@ -3,9 +3,8 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ChannelExtractor;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
/**
* Created by Christian Schabesberger on 12.09.16.
@@ -33,8 +32,13 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
extractor = ServiceList.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0, new Downloader());
NewPipe.init(Downloader.getInstance());
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 0);
}
public void testGetDownloader() throws Exception {
assertNotNull(NewPipe.getDownloader());
}
public void testGetChannelName() throws Exception {
@@ -67,14 +71,14 @@ public class YoutubeChannelExtractorTest extends AndroidTestCase {
}
public void testGetNextPage() throws Exception {
extractor = ServiceList.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 1, new Downloader());
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 1);
assertTrue("next page didn't have content", !extractor.getStreams().getItemList().isEmpty());
}
public void testGetNextNextPageUrl() throws Exception {
extractor = ServiceList.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 2, new Downloader());
extractor = NewPipe.getService("Youtube")
.getChannelExtractorInstance("https://www.youtube.com/channel/UCYJ61XIK64sp6ZFFS8sctxw", 2);
assertTrue("next page didn't have content", extractor.hasNextPage());
}
}

View File

@@ -2,15 +2,11 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.SearchResult;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamPreviewInfo;
import org.schabi.newpipe.extractor.SearchEngine;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.search.SearchEngine;
import org.schabi.newpipe.extractor.search.SearchResult;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;
/**
@@ -35,16 +31,26 @@ import java.util.List;
public class YoutubeSearchEngineTest extends AndroidTestCase {
private SearchResult result;
private List<String> suggestionReply;
@Override
public void setUp() throws Exception {
super.setUp();
SearchEngine engine = ServiceList.getService("Youtube")
.getSearchEngineInstance(new Downloader());
NewPipe.init(Downloader.getInstance());
SearchEngine engine = NewPipe.getService("Youtube").getSearchEngineInstance();
result = engine.search("this is something boring",
0, "de", new Downloader()).getSearchResult();
suggestionReply = engine.suggestionList("hello", "de", new Downloader());
result = engine.search("this is something boring", 0, "de").getSearchResult();
}
public void testResultList() {
assertFalse(result.resultList.isEmpty());
}
public void testResultErrors() {
assertTrue(result.errors == null || result.errors.isEmpty());
}
public void testSuggestion() {
//todo write a real test
assertTrue(result.suggestion != null);
}
}

View File

@@ -0,0 +1,49 @@
package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.search.SuggestionExtractor;
import org.schabi.newpipe.extractor.services.youtube.YoutubeSuggestionExtractor;
import java.io.IOException;
import java.util.List;
/**
* Created by Christian Schabesberger on 18.11.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* YoutubeSearchResultTest.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class YoutubeSearchResultTest extends AndroidTestCase {
List<String> suggestionReply;
@Override
public void setUp() throws Exception {
super.setUp();
NewPipe.init(Downloader.getInstance());
SuggestionExtractor engine = new YoutubeSuggestionExtractor(0);
suggestionReply = engine.suggestionList("hello", "de");
}
public void testIfSuggestions() {
assertFalse(suggestionReply.isEmpty());
}
}

View File

@@ -3,12 +3,12 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.VideoStream;
import org.schabi.newpipe.extractor.AbstractStreamInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
import org.schabi.newpipe.extractor.stream_info.VideoStream;
import java.io.IOException;
@@ -36,9 +36,11 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
public static final String HTTPS = "https://";
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
extractor = ServiceList.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A", new Downloader());
public void setUp() throws Exception {
super.setUp();
NewPipe.init(Downloader.getInstance());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=YQHsXMglC9A");
}
public void testGetInvalidTimeStamp() throws ParsingException {
@@ -48,8 +50,8 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
public void testGetValidTimeStamp() throws ExtractionException, IOException {
StreamExtractor extractor =
ServiceList.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174", new Downloader());
NewPipe.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174");
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);
}
@@ -108,7 +110,7 @@ public class YoutubeStreamExtractorDefaultTest extends AndroidTestCase {
}
public void testStreamType() throws ParsingException {
assertTrue(extractor.getStreamType() == AbstractVideoInfo.StreamType.VIDEO_STREAM);
assertTrue(extractor.getStreamType() == AbstractStreamInfo.StreamType.VIDEO_STREAM);
}
public void testGetDashMpd() throws ParsingException {

View File

@@ -3,8 +3,8 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
import java.io.IOException;
@@ -39,9 +39,9 @@ public class YoutubeStreamExtractorGemaTest extends AndroidTestCase {
public void testGemaError() throws IOException, ExtractionException {
if(testActive) {
try {
ServiceList.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8",
new Downloader());
NewPipe.init(Downloader.getInstance());
NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=3O1_3zBUKM8");
} catch(YoutubeStreamExtractor.GemaException ge) {
assertTrue(true);
}

View File

@@ -2,12 +2,10 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.AbstractVideoInfo;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
import java.io.IOException;
@@ -39,8 +37,10 @@ public class YoutubeStreamExtractorLiveStreamTest extends AndroidTestCase {
public void setUp() throws IOException, ExtractionException {
//todo: make the extractor not throw over a livestream
/*
extractor = ServiceList.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", new Downloader());
NewPipe.init(Downloader.getInstance());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=J0s6NjqdjLE", Downloader.getInstance());
*/
}

View File

@@ -3,11 +3,11 @@ package org.schabi.newpipe.extractor.youtube;
import android.test.AndroidTestCase;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.VideoStream;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
import org.schabi.newpipe.extractor.stream_info.VideoStream;
import java.io.IOException;
@@ -15,10 +15,11 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
public static final String HTTPS = "https://";
private StreamExtractor extractor;
public void setUp() throws IOException, ExtractionException {
extractor = ServiceList.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0",
new Downloader());
public void setUp() throws Exception {
super.setUp();
NewPipe.init(Downloader.getInstance());
extractor = NewPipe.getService("Youtube")
.getExtractorInstance("https://www.youtube.com/watch?v=i6JTvzrpBy0");
}
public void testGetInvalidTimeStamp() throws ParsingException {
@@ -27,9 +28,8 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
}
public void testGetValidTimeStamp() throws ExtractionException, IOException {
StreamExtractor extractor=ServiceList.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174",
new Downloader());
StreamExtractor extractor= NewPipe.getService("Youtube")
.getExtractorInstance("https://youtu.be/FmG385_uUys?t=174");
assertTrue(Integer.toString(extractor.getTimeStamp()),
extractor.getTimeStamp() == 174);
}
@@ -73,7 +73,8 @@ public class YoutubeStreamExtractorRestrictedTest extends AndroidTestCase {
}
public void testGetAudioStreams() throws ParsingException {
assertTrue(!extractor.getAudioStreams().isEmpty());
// audiostream not always necessary
//assertTrue(!extractor.getAudioStreams().isEmpty());
}
public void testGetVideoStreams() throws ParsingException {

View File

@@ -29,6 +29,7 @@
<activity
android:name=".detail.VideoItemDetailActivity"
android:label="@string/title_videoitem_detail"
android:launchMode="singleTask"
android:theme="@style/AppTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
@@ -75,6 +76,11 @@
<data android:scheme="vnd.youtube" />
<data android:scheme="vnd.youtube.launch" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".player.PlayVideoActivity"
@@ -133,7 +139,7 @@
<!-- giga get related -->
<activity
android:name=".download.MainActivity"
android:name=".download.DownloadActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/AppTheme" />
@@ -152,6 +158,9 @@
android:label="@string/title_activity_channel"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".ReCaptchaActivity"
android:label="@string/reCaptchaActivity" />
</application>
</manifest>

View File

@@ -11,6 +11,7 @@ import org.acra.config.ACRAConfiguration;
import org.acra.config.ACRAConfigurationException;
import org.acra.config.ConfigurationBuilder;
import org.acra.sender.ReportSenderFactory;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.report.AcraReportSenderFactory;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.settings.SettingsActivity;
@@ -60,6 +61,9 @@ public class App extends Application {
"Could not initialize ACRA crash report", R.string.app_ui_crash));
}
//init NewPipe
NewPipe.init(Downloader.getInstance());
// Initialize image loader
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
ImageLoader.getInstance().init(config);

View File

@@ -20,12 +20,12 @@ import com.nostra13.universalimageloader.core.ImageLoader;
import org.schabi.newpipe.detail.VideoItemDetailActivity;
import org.schabi.newpipe.detail.VideoItemDetailFragment;
import org.schabi.newpipe.extractor.ChannelExtractor;
import org.schabi.newpipe.extractor.ChannelInfo;
import org.schabi.newpipe.extractor.ExtractionException;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
import org.schabi.newpipe.extractor.channel.ChannelInfo;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.info_list.InfoListAdapter;
import org.schabi.newpipe.report.ErrorActivity;
@@ -188,11 +188,11 @@ public class ChannelActivity extends AppCompatActivity {
public void run() {
StreamingService service = null;
try {
service = ServiceList.getService(serviceId);
service = NewPipe.getService(serviceId);
ChannelExtractor extractor = service.getChannelExtractorInstance(
channelUrl, pageNumber, new Downloader());
channelUrl, pageNumber);
final ChannelInfo info = ChannelInfo.getInfo(extractor, new Downloader());
final ChannelInfo info = ChannelInfo.getInfo(extractor);
h.post(new Runnable() {

View File

@@ -1,5 +1,7 @@
package org.schabi.newpipe;
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -35,13 +37,37 @@ import javax.net.ssl.HttpsURLConnection;
public class Downloader implements org.schabi.newpipe.extractor.Downloader {
private static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0";
private static String mCookies = "";
private static Downloader instance = null;
private Downloader() {}
public static Downloader getInstance() {
if(instance == null) {
synchronized (Downloader.class) {
if (instance == null) {
instance = new Downloader();
}
}
}
return instance;
}
public static synchronized void setCookies(String cookies) {
Downloader.mCookies = cookies;
}
public static synchronized String getCookies() {
return Downloader.mCookies;
}
/**Download the text file at the supplied URL as in download(String),
* but set the HTTP header field "Accept-Language" to the supplied string.
* @param siteUrl the URL of the text file to return the contents of
* @param language the language (usually a 2-character code) to set as the preferred language
* @return the contents of the specified text file*/
public String download(String siteUrl, String language) throws IOException {
public String download(String siteUrl, String language) throws IOException, ReCaptchaException {
Map<String, String> requestProperties = new HashMap<>();
requestProperties.put("Accept-Language", language);
return download(siteUrl, requestProperties);
@@ -54,7 +80,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
* @param customProperties set request header properties
* @return the contents of the specified text file
* @throws IOException*/
public String download(String siteUrl, Map<String, String> customProperties) throws IOException {
public String download(String siteUrl, Map<String, String> customProperties) throws IOException, ReCaptchaException {
URL url = new URL(siteUrl);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
Iterator it = customProperties.entrySet().iterator();
@@ -66,7 +92,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
}
/**Common functionality between download(String url) and download(String url, String language)*/
private static String dl(HttpsURLConnection con) throws IOException {
private static String dl(HttpsURLConnection con) throws IOException, ReCaptchaException {
StringBuilder response = new StringBuilder();
BufferedReader in = null;
@@ -74,6 +100,10 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", USER_AGENT);
if (getCookies().length() > 0) {
con.setRequestProperty("Cookie", getCookies());
}
in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
@@ -85,6 +115,14 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
throw new IOException("unknown host or no network", uhe);
//Toast.makeText(getActivity(), uhe.getMessage(), Toast.LENGTH_LONG).show();
} catch(Exception e) {
/*
* HTTP 429 == Too Many Request
* Receive from Youtube.com = ReCaptcha challenge request
* See : https://github.com/rg3/youtube-dl/issues/5138
*/
if (con.getResponseCode() == 429) {
throw new ReCaptchaException("reCaptcha Challenge requested");
}
throw new IOException(e);
} finally {
if(in != null) {
@@ -99,7 +137,7 @@ public class Downloader implements org.schabi.newpipe.extractor.Downloader {
* Primarily intended for downloading web pages.
* @param siteUrl the URL of the text file to download
* @return the contents of the specified text file*/
public String download(String siteUrl) throws IOException {
public String download(String siteUrl) throws IOException, ReCaptchaException {
URL url = new URL(siteUrl);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
//HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);

View File

@@ -8,7 +8,7 @@ import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
/**
* Created by Christian Schabesberger on 01.08.16.
@@ -50,7 +50,7 @@ public class ImageErrorLoadingListener implements ImageLoadingListener {
ErrorActivity.reportError(activity,
failReason.getCause(), null, rootView,
ErrorActivity.ErrorInfo.make(ErrorActivity.LOAD_IMAGE,
ServiceList.getNameOfService(serviceId), imageUri,
NewPipe.getNameOfService(serviceId), imageUri,
R.string.could_not_load_image));
}

View File

@@ -16,7 +16,7 @@ import org.schabi.newpipe.settings.SettingsActivity;
* Created by Christian Schabesberger on 02.08.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* MainActivity.java is part of NewPipe.
* DownloadActivity.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@ public class MainActivity extends AppCompatActivity {
.findFragmentById(R.id.search_fragment);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
@@ -73,7 +74,7 @@ public class MainActivity extends AppCompatActivity {
return true;
}
case R.id.action_show_downloads: {
Intent intent = new Intent(this, org.schabi.newpipe.download.MainActivity.class);
Intent intent = new Intent(this, org.schabi.newpipe.download.DownloadActivity.class);
startActivity(intent);
return true;
}

View File

@@ -0,0 +1,151 @@
package org.schabi.newpipe;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* Created by beneth <bmauduit@beneth.fr> on 06.12.16.
*
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* ReCaptchaActivity.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class ReCaptchaActivity extends AppCompatActivity {
public static final int RECAPTCHA_REQUEST = 10;
public static final String TAG = ReCaptchaActivity.class.toString();
public static final String YT_URL = "https://www.youtube.com";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recaptcha);
// Set return to Cancel by default
setResult(RESULT_CANCELED);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.reCaptcha_title);
actionBar.setDisplayShowTitleEnabled(true);
WebView myWebView = (WebView) findViewById(R.id.reCaptchaWebView);
// Enable Javascript
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
ReCaptchaWebViewClient webClient = new ReCaptchaWebViewClient(this);
myWebView.setWebViewClient(webClient);
// Cleaning cache, history and cookies from webView
myWebView.clearCache(true);
myWebView.clearHistory();
android.webkit.CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
cookieManager.removeAllCookies(new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean aBoolean) {}
});
} else {
cookieManager.removeAllCookie();
}
myWebView.loadUrl(YT_URL);
}
private class ReCaptchaWebViewClient extends WebViewClient {
private Activity context;
private String mCookies;
ReCaptchaWebViewClient(Activity ctx) {
context = ctx;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO: Start Loader
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
String cookies = CookieManager.getInstance().getCookie(url);
// TODO: Stop Loader
// find cookies : s_gl & goojf and Add cookies to Downloader
if (find_access_cookies(cookies)) {
// Give cookies to Downloader class
Downloader.setCookies(mCookies);
// Closing activity and return to parent
setResult(RESULT_OK);
finish();
}
}
private boolean find_access_cookies(String cookies) {
boolean ret = false;
String c_s_gl = "";
String c_goojf = "";
String[] parts = cookies.split("; ");
for (String part : parts) {
if (part.trim().startsWith("s_gl")) {
c_s_gl = part.trim();
}
if (part.trim().startsWith("goojf")) {
c_goojf = part.trim();
}
}
if (c_s_gl.length() > 0 && c_goojf.length() > 0) {
ret = true;
//mCookies = c_s_gl + "; " + c_goojf;
// Youtube seems to also need the other cookies:
mCookies = cookies;
}
return ret;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id) {
case android.R.id.home: {
Intent intent = new Intent(this, org.schabi.newpipe.MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
NavUtils.navigateUpTo(this, intent);
return true;
}
default:
return false;
}
}
}

View File

@@ -14,7 +14,7 @@ import android.widget.ArrayAdapter;
import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.SettingsActivity;
import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.VideoStream;
import org.schabi.newpipe.extractor.stream_info.VideoStream;
import java.util.List;
@@ -111,6 +111,9 @@ class ActionBarHandler {
private int getDefaultResolution(final List<VideoStream> videoStreams) {
if (defaultPreferences == null)
return 0;
String defaultResolution = defaultPreferences
.getString(activity.getString(R.string.default_resolution_key),
activity.getString(R.string.default_resolution_value));
@@ -183,7 +186,7 @@ class ActionBarHandler {
return true;
case R.id.menu_item_downloads: {
Intent intent =
new Intent(activity, org.schabi.newpipe.download.MainActivity.class);
new Intent(activity, org.schabi.newpipe.download.DownloadActivity.class);
activity.startActivity(intent);
return true;
}

View File

@@ -5,20 +5,36 @@ import android.os.Handler;
import android.util.Log;
import android.view.View;
import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
import org.schabi.newpipe.extractor.stream_info.StreamExtractor;
import org.schabi.newpipe.extractor.stream_info.StreamInfo;
import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.ParsingException;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamExtractor;
import org.schabi.newpipe.extractor.StreamInfo;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.services.youtube.YoutubeStreamExtractor;
import java.io.IOException;
/**
* Created by the-scrabi on 02.08.16.
* Created by Christian Schabesberger on 02.08.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* StreamInfoWorker.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
public class StreamInfoWorker {
@@ -28,6 +44,7 @@ public class StreamInfoWorker {
public interface OnStreamInfoReceivedListener {
void onReceive(StreamInfo info);
void onError(int messageId);
void onReCaptchaException();
void onBlockedByGemaError();
void onContentErrorWithMessage(int messageId);
void onContentError();
@@ -51,7 +68,7 @@ public class StreamInfoWorker {
StreamInfo streamInfo = null;
StreamingService service = null;
try {
service = ServiceList.getService(serviceId);
service = NewPipe.getService(serviceId);
} catch (Exception e) {
e.printStackTrace();
ErrorActivity.reportError(h, a, e, VideoItemDetailFragment.class, null,
@@ -60,8 +77,8 @@ public class StreamInfoWorker {
return;
}
try {
streamExtractor = service.getExtractorInstance(videoUrl, new Downloader());
streamInfo = StreamInfo.getVideoInfo(streamExtractor, new Downloader());
streamExtractor = service.getExtractorInstance(videoUrl);
streamInfo = StreamInfo.getVideoInfo(streamExtractor);
final StreamInfo info = streamInfo;
h.post(new Runnable() {
@@ -91,6 +108,13 @@ public class StreamInfoWorker {
}
// These errors render the stream information unusable.
} catch (ReCaptchaException e) {
h.post(new Runnable() {
@Override
public void run() {
onStreamInfoReceivedListener.onReCaptchaException();
}
});
} catch (IOException e) {
h.post(new Runnable() {
@Override
@@ -99,9 +123,8 @@ public class StreamInfoWorker {
}
});
e.printStackTrace();
}
// custom service related exceptions
catch (YoutubeStreamExtractor.DecryptException de) {
} catch (YoutubeStreamExtractor.DecryptException de) {
// custom service related exceptions
h.post(new Runnable() {
@Override
public void run() {

View File

@@ -14,9 +14,12 @@ import android.widget.Toast;
import org.schabi.newpipe.App;
import org.schabi.newpipe.MainActivity;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import java.util.Collection;
import java.util.HashSet;
/**
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
@@ -38,6 +41,13 @@ import org.schabi.newpipe.extractor.StreamingService;
public class VideoItemDetailActivity extends AppCompatActivity {
/**
* Removes invisible separators (\p{Z}) and punctuation characters including
* brackets (\p{P}). See http://www.regular-expressions.info/unicode.html for
* more details.
*/
private final static String REGEX_REMOVE_FROM_URL = "[\\p{Z}\\p{P}]";
private static final String TAG = VideoItemDetailActivity.class.toString();
private VideoItemDetailFragment fragment;
@@ -68,52 +78,58 @@ public class VideoItemDetailActivity extends AppCompatActivity {
// http://developer.android.com/guide/components/fragments.html
//
Bundle arguments = new Bundle();
if (savedInstanceState == null) {
// this means the video was called though another app
if (getIntent().getData() != null) {
videoUrl = getIntent().getData().toString();
StreamingService[] serviceList = ServiceList.getServices();
//StreamExtractor videoExtractor = null;
for (int i = 0; i < serviceList.length; i++) {
if (serviceList[i].getUrlIdHandlerInstance().acceptUrl(videoUrl)) {
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i);
currentStreamingService = i;
//videoExtractor = ServiceList.getService(i).getExtractorInstance();
break;
}
}
if(currentStreamingService == -1) {
Toast.makeText(this, R.string.url_not_supported_toast, Toast.LENGTH_LONG)
.show();
}
//arguments.putString(VideoItemDetailFragment.VIDEO_URL,
// videoExtractor.getUrl(videoExtractor.getId(videoUrl)));//cleans URL
arguments.putString(VideoItemDetailFragment.VIDEO_URL, videoUrl);
arguments.putBoolean(VideoItemDetailFragment.AUTO_PLAY,
PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean(getString(R.string.autoplay_through_intent_key), false));
} else {
videoUrl = getIntent().getStringExtra(VideoItemDetailFragment.VIDEO_URL);
currentStreamingService = getIntent().getIntExtra(VideoItemDetailFragment.STREAMING_SERVICE, -1);
arguments.putString(VideoItemDetailFragment.VIDEO_URL, videoUrl);
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, currentStreamingService);
arguments.putBoolean(VideoItemDetailFragment.AUTO_PLAY, false);
}
handleIntent(getIntent());
} else {
videoUrl = savedInstanceState.getString(VideoItemDetailFragment.VIDEO_URL);
currentStreamingService = savedInstanceState.getInt(VideoItemDetailFragment.STREAMING_SERVICE);
arguments = savedInstanceState;
addFragment(savedInstanceState);
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
handleIntent(intent);
}
private void handleIntent(Intent intent) {
Bundle arguments = new Bundle();
boolean autoplay = false;
if (intent.getData() != null) {
// this means the video was called though another app
videoUrl = intent.getData().toString();
currentStreamingService = getServiceIdByUrl(videoUrl);
if(currentStreamingService == -1) {
Toast.makeText(this, R.string.url_not_supported_toast, Toast.LENGTH_LONG)
.show();
}
autoplay = PreferenceManager.getDefaultSharedPreferences(this)
.getBoolean(getString(R.string.autoplay_through_intent_key), false);
} else if(intent.getStringExtra(Intent.EXTRA_TEXT) != null) {
//this means that vidoe was called through share menu
String extraText = intent.getStringExtra(Intent.EXTRA_TEXT);
videoUrl = getUris(extraText)[0];
currentStreamingService = getServiceIdByUrl(videoUrl);
} else {
//this is if the video was called through another NewPipe activity
videoUrl = intent.getStringExtra(VideoItemDetailFragment.VIDEO_URL);
currentStreamingService = intent.getIntExtra(VideoItemDetailFragment.STREAMING_SERVICE, -1);
}
arguments.putBoolean(VideoItemDetailFragment.AUTO_PLAY, autoplay);
arguments.putString(VideoItemDetailFragment.VIDEO_URL, videoUrl);
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, currentStreamingService);
addFragment(arguments);
}
private void addFragment(final Bundle arguments) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
fragment = new VideoItemDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.videoitem_detail_container, fragment)
.replace(R.id.videoitem_detail_container, fragment)
.commit();
}
@@ -157,4 +173,70 @@ public class VideoItemDetailActivity extends AppCompatActivity {
fragment.onCreateOptionsMenu(menu, getMenuInflater());
return true;
}
/**
* Retrieves all Strings which look remotely like URLs from a text.
* Used if NewPipe was called through share menu.
*
* @param sharedText text to scan for URLs.
* @return potential URLs
*/
private String[] getUris(final String sharedText) {
final Collection<String> result = new HashSet<>();
if (sharedText != null) {
final String[] array = sharedText.split("\\p{Space}");
for (String s : array) {
s = trim(s);
if (s.length() != 0) {
if (s.matches(".+://.+")) {
result.add(removeHeadingGibberish(s));
} else if (s.matches(".+\\..+")) {
result.add("http://" + s);
}
}
}
}
return result.toArray(new String[result.size()]);
}
private static String removeHeadingGibberish(final String input) {
int start = 0;
for (int i = input.indexOf("://") - 1; i >= 0; i--) {
if (!input.substring(i, i + 1).matches("\\p{L}")) {
start = i + 1;
break;
}
}
return input.substring(start, input.length());
}
private static String trim(final String input) {
if (input == null || input.length() < 1) {
return input;
} else {
String output = input;
while (output.length() > 0 && output.substring(0, 1).matches(REGEX_REMOVE_FROM_URL)) {
output = output.substring(1);
}
while (output.length() > 0
&& output.substring(output.length() - 1, output.length()).matches(REGEX_REMOVE_FROM_URL)) {
output = output.substring(0, output.length() - 1);
}
return output;
}
}
private int getServiceIdByUrl(String url) {
StreamingService[] serviceList = NewPipe.getServices();
int service = -1;
for (int i = 0; i < serviceList.length; i++) {
if (serviceList[i].getUrlIdHandlerInstance().acceptUrl(videoUrl)) {
service = i;
//videoExtractor = ServiceList.getService(i).getExtractorInstance();
break;
}
}
return service;
}
}

View File

@@ -23,6 +23,7 @@ import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -41,13 +42,13 @@ import us.shandian.giga.ui.fragment.MissionsFragment;
import us.shandian.giga.util.CrashHandler;
import us.shandian.giga.util.Utility;
public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{
public class DownloadActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{
public static final String INTENT_DOWNLOAD = "us.shandian.giga.intent.DOWNLOAD";
public static final String INTENT_LIST = "us.shandian.giga.intent.LIST";
private static final String TAG = MainActivity.class.toString();
private static final String TAG = DownloadActivity.class.toString();
public static final String THREADS = "threads";
@@ -150,6 +151,8 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
final TextView tCount = Utility.findViewById(v, R.id.threads_count);
final SeekBar threads = Utility.findViewById(v, R.id.threads);
final Toolbar toolbar = Utility.findViewById(v, R.id.toolbar);
final RadioButton audioButton = (RadioButton) Utility.findViewById(v, R.id.audio_button);
threads.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@@ -204,12 +207,16 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
File f = new File(mManager.getLocation() + "/" + fName);
if (f.exists()) {
Toast.makeText(MainActivity.this, R.string.msg_exists, Toast.LENGTH_SHORT).show();
Toast.makeText(DownloadActivity.this, R.string.msg_exists, Toast.LENGTH_SHORT).show();
} else {
while (mBinder == null);
int res = mManager.startMission(getIntent().getData().toString(), fName, threads.getProgress() + 1);
int res = mManager.startMission(
getIntent().getData().toString(),
fName,
audioButton.isChecked(),
threads.getProgress() + 1);
mBinder.onMissionAdded(mManager.getMission(res));
mFragment.notifyChange();
@@ -258,7 +265,7 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
return true;
}
case R.id.action_report_error: {
ErrorActivity.reportError(MainActivity.this, new Vector<Throwable>(),
ErrorActivity.reportError(DownloadActivity.this, new Vector<Throwable>(),
null, null,
ErrorActivity.ErrorInfo.make(ErrorActivity.USER_REPORT,
null,

View File

@@ -32,6 +32,7 @@ import java.util.ArrayList;
import java.util.List;
import us.shandian.giga.get.DownloadManager;
import us.shandian.giga.get.DownloadMission;
import us.shandian.giga.service.DownloadManagerService;
@@ -225,16 +226,26 @@ public class DownloadDialog extends DialogFragment {
int res = mManager.startMission(
arguments.getString(AUDIO_URL),
fName + arguments.getString(FILE_SUFFIX_AUDIO),
audioButton.isChecked(),
threads.getProgress() + 1);
mBinder.onMissionAdded(mManager.getMission(res));
DownloadMission mission = mManager.getMission(res);
mBinder.onMissionAdded(mission);
// add download listener to allow media scan notification
DownloadListener listener = new DownloadListener(getContext(), mission);
mission.addListener(listener);
}
if(videoButton.isChecked()){
int res = mManager.startMission(
arguments.getString(VIDEO_URL),
fName + arguments.getString(FILE_SUFFIX_VIDEO),
audioButton.isChecked(),
threads.getProgress() + 1);
mBinder.onMissionAdded(mManager.getMission(res));
DownloadMission mission = mManager.getMission(res);
mBinder.onMissionAdded(mission);
// add download listener to allow media scan notification
DownloadListener listener = new DownloadListener(getContext(), mission);
mission.addListener(listener);
}
getDialog().dismiss();
@@ -255,8 +266,8 @@ public class DownloadDialog extends DialogFragment {
//we'll see later
FileDownloader.downloadFile(getContext(), url, saveFilePath, title);
} else {
Intent intent = new Intent(getContext(), MainActivity.class);
intent.setAction(MainActivity.INTENT_DOWNLOAD);
Intent intent = new Intent(getContext(), DownloadActivity.class);
intent.setAction(DownloadActivity.INTENT_DOWNLOAD);
intent.setData(Uri.parse(url));
intent.putExtra("fileName", createFileName(title) + fileSuffix);
startActivity(intent);

View File

@@ -0,0 +1,62 @@
package org.schabi.newpipe.download;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import us.shandian.giga.get.DownloadMission;
import us.shandian.giga.get.DownloadMission.MissionListener;
/**
* Created by erwin on 06.11.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* DownloadListener.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NewPipe is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
class DownloadListener implements MissionListener
{
DownloadMission mMission;
Context mContext;
public DownloadListener(Context context, DownloadMission mission)
{
super();
mMission = mission;
mContext = context;
}
@Override
public void onProgressUpdate(long done, long total)
{
// do nothing special ...
}
@Override
public void onFinish()
{
// notify media scanner on downloaded media file ...
mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.parse( "file://" + mMission.location
+ "/" + mMission.name)));
}
@Override
public void onError(int errCode)
{
// do nothing special ...
}
}

View File

@@ -1,10 +1,8 @@
package org.schabi.newpipe.extractor;
import android.graphics.Bitmap;
/**
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
* AbstractVideoInfo.java is part of NewPipe.
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* AbstractStreamInfo.java is part of NewPipe.
*
* NewPipe is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,7 +19,7 @@ import android.graphics.Bitmap;
*/
/**Common properties between StreamInfo and StreamPreviewInfo.*/
public abstract class AbstractVideoInfo {
public abstract class AbstractStreamInfo {
public static enum StreamType {
NONE, // placeholder to check if stream type was checked or not
VIDEO_STREAM,
@@ -37,7 +35,6 @@ public abstract class AbstractVideoInfo {
public String title = "";
public String uploader = "";
public String thumbnail_url = "";
public Bitmap thumbnail;
public String webpage_url = "";
public String upload_date = "";
public long view_count = -1;

View File

@@ -2,6 +2,9 @@ package org.schabi.newpipe.extractor;
import android.util.Xml;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
import org.schabi.newpipe.extractor.stream_info.AudioStream;
import org.xmlpull.v1.XmlPullParser;
import java.io.IOException;
@@ -40,14 +43,16 @@ public class DashMpdParser {
}
}
public static List<AudioStream> getAudioStreams(String dashManifestUrl,
Downloader downloader)
throws DashMpdParsingException {
public static List<AudioStream> getAudioStreams(String dashManifestUrl)
throws DashMpdParsingException, ReCaptchaException {
String dashDoc;
Downloader downloader = NewPipe.getDownloader();
try {
dashDoc = downloader.download(dashManifestUrl);
} catch(IOException ioe) {
throw new DashMpdParsingException("Could not get dash mpd: " + dashManifestUrl, ioe);
} catch (ReCaptchaException e) {
throw new ReCaptchaException("reCaptcha Challenge needed");
}
Vector<AudioStream> audioStreams = new Vector<>();
try {

View File

@@ -1,5 +1,7 @@
package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
import java.io.IOException;
import java.util.Map;
@@ -31,7 +33,7 @@ public interface Downloader {
* @param language the language (usually a 2-character code) to set as the preferred language
* @return the contents of the specified text file
* @throws IOException*/
String download(String siteUrl, String language) throws IOException;
String download(String siteUrl, String language) throws IOException, ReCaptchaException;
/**Download the text file at the supplied URL as in download(String),
* but set the HTTP header field "Accept-Language" to the supplied string.
@@ -39,12 +41,12 @@ public interface Downloader {
* @param customProperties set request header properties
* @return the contents of the specified text file
* @throws IOException*/
String download(String siteUrl, Map<String, String> customProperties) throws IOException;
String download(String siteUrl, Map<String, String> customProperties) throws IOException, ReCaptchaException;
/**Download (via HTTP) the text file located at the supplied URL, and return its contents.
* Primarily intended for downloading web pages.
* @param siteUrl the URL of the text file to download
* @return the contents of the specified text file
* @throws IOException*/
String download(String siteUrl) throws IOException;
String download(String siteUrl) throws IOException, ReCaptchaException;
}

Some files were not shown because too many files have changed in this diff Show More