Examples in documentation needed
As a beginner at using NewPipeExtractor, i have generally no clue how to properly use the library in my project. Could you give some code example of downloading video/audio of Youtube video with an example of how to import it into the file? I get errors when i import with
com.github.TeamNewPipe.NewPipeExtractor
What is problem here?
Any help is greatly appreciated.
From the README:
If you're using Gradle, you could add NewPipe Extractor as a dependency with the following steps:
- Add
maven { url 'https://jitpack.io' }to therepositoriesin yourbuild.gradle.- Add
compile 'com.github.TeamNewPipe:NewPipeExtractor:v0.11.0'thedependenciesin yourbuild.gradle. Replacev0.11.0with the latest release.
Then to import things from it do import org.schabi.newpipe.extractor.* replacing * with the file/path you want to import.
To get an idea about the usage you can take a look at tests (e.g. this test contains on lines 54-57 the youtube stream extractor initialization and on lines 134-139 how download urls can be retrieved)
I agree that documentation is needed
Maybe someone can write a new chapter about using the extractor outside NewPipe. As @Stypox suggested, it should contain:
- Build setup
- initializing the extractor
- fetching stream info
- getting download urls
Thank you very much for the speedy response, I shall try this out and see if it works. Will come back if error occurs again.
I am having a problem where when I follow the example that @Stypox gave,my nativescript application says that :
ERROR TypeError: Cannot read property 'getInstance' of undefined
JS: ERROR CONTEXT {
JS: "view": {
JS: "def": {
JS: "nodeFlags": 33734657,
JS: "rootNodeFlags": 33554433,
JS: "nodeMatchedQueries": 0,
JS: "flags": 0,
JS: "nodes": [
JS: {
JS: "nodeIndex": 0,
JS: "parent": null,
JS: "renderParent": null,
JS: "bindingIndex": 0,
JS: "outputIndex": 0,
JS: "checkIndex": 0,
JS: "flags": 33554433,
JS: "childFlags": 180225,
JS: "directChildFlags": 49153,
JS: "childMatchedQueries": 0,
JS: "matchedQueries": {},
JS: "matchedQueryIds": 0,
JS: "references": {},
JS: "ngContentIndex": null,
JS: "childCount": 3,
JS: "bindings": [],
JS: "bindingFlags": 0,
JS: "outputs": [],
JS: "element": {
JS: "ns": "",
JS: "name": "ActionBar",
JS: "attrs": [
JS: [
JS: "",
JS: "title",
JS: "Yt Download"
JS: ]
JS: ],
JS: "template": null,
JS: "componentProvider": {
JS: "nodeInd...
I think that it is having difficulty understanding the code around here with getInstance() in the test file:
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
extractor = (YoutubeStreamExtractor) YouTube
.getStreamExtractor("https://www.youtube.com/watch?v=YQHsXMglC9A");
extractor.fetchPage();
Correct me if I am wrong, but isn't nativescript based on JS? This matches the log.
Cannot read property 'getInstance' of undefined is a JS error. The extractor is written in Java.
Yes it's written in JavaScript but it is possible to port over the test code to use the library,which is why I'm using it. I haven't found any other alternative than newpipe extractor to extract videos from. Most libs are unreliable which is why I picked new pipe. Is there any way I could fix this error to your knowledge?
If not, I'll have to abandon using the repo.
Thanks for your help.
On Sat, 17 Aug 2019, 22:12 Tobias Groza, [email protected] wrote:
Correct me if I am wrong, but isn't nativescript basde on JS? This matches the log. Cannot read property 'getInstance' of undefined is a JS error. The extractor is written in Java.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TeamNewPipe/documentation/issues/13?email_source=notifications&email_token=AKHDUOHPLCNENQY3QNDZXA3QFBST5A5CNFSM4IMQKCM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QTRRQ#issuecomment-522270918, or mute the thread https://github.com/notifications/unsubscribe-auth/AKHDUOAV6AWP2X6URMBDB2LQFBST5ANCNFSM4IMQKCMQ .
I am using the library in nativescript which is why it's written in js.
On Sat, 17 Aug 2019, 22:24 John Wall, [email protected] wrote:
Yes it's written in JavaScript but it is possible to port over the test code to use the library,which is why I'm using it. I haven't found any other alternative than newpipe extractor to extract videos from. Most libs are unreliable which is why I picked new pipe. Is there any way I could fix this error to your knowledge?
If not, I'll have to abandon using the repo.
Thanks for your help.
On Sat, 17 Aug 2019, 22:12 Tobias Groza, [email protected] wrote:
Correct me if I am wrong, but isn't nativescript basde on JS? This matches the log. Cannot read property 'getInstance' of undefined is a JS error. The extractor is written in Java.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TeamNewPipe/documentation/issues/13?email_source=notifications&email_token=AKHDUOHPLCNENQY3QNDZXA3QFBST5A5CNFSM4IMQKCM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QTRRQ#issuecomment-522270918, or mute the thread https://github.com/notifications/unsubscribe-auth/AKHDUOAV6AWP2X6URMBDB2LQFBST5ANCNFSM4IMQKCMQ .
Noone can guarantee transpiled code works. Normally changes are required to make that work. That applies to tools like e.g., emscripten when transpiling larger chunks of code, such as for instance a game engine.
Generally I'd say transpiled code can't be supported by the team. They're trying their best, though. @johnny-stevie I'd recommend you to share your a link to your repository. Please note that this is GPL licensed code, so you're obliged to put your own code under the same library, even if transpiled.
@Stypox @TobiGr is there any quick test code @johnny-stevie could use to check whether the transpiled library works at all?
@johnny-stevie: You shouldn't use the Downloader class, but your implementation of it. See DownloaderImpl in NewPipeExtractor's tests, or DownloaderImpl in NewPipe for 2 different example implementations.
see Using Newpipe Extractor it might help :smile:
@cloneconf great! Could you contribute the guide you setup to NewPipeExtractor? (I don't know where, maybe in the wiki or maybe directly in the readme, or maybe in this repository, what do you think @TobiGr @litetex ?)
I am already working on this with @TobiGr, here :smile: