Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Examples in documentation needed #13

Open
johnny-stevie opened this issue Aug 17, 2019 · 12 comments
Open

Examples in documentation needed #13

johnny-stevie opened this issue Aug 17, 2019 · 12 comments

Comments

@johnny-stevie
Copy link

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.

@Stypox
Copy link
Member

Stypox commented Aug 17, 2019

From the README:

If you're using Gradle, you could add NewPipe Extractor as a dependency with the following steps:

  1. Add maven { url 'https://jitpack.io' } to the repositories in your build.gradle.
  2. Add compile 'com.github.TeamNewPipe:NewPipeExtractor:v0.11.0'the dependencies in your build.gradle. Replace v0.11.0 with 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

@TobiGr
Copy link
Contributor

TobiGr commented Aug 17, 2019

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

@TobiGr TobiGr transferred this issue from TeamNewPipe/NewPipeExtractor Aug 17, 2019
@johnny-stevie
Copy link
Author

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.

@johnny-stevie
Copy link
Author

johnny-stevie commented Aug 17, 2019

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();

@TobiGr
Copy link
Contributor

TobiGr commented Aug 17, 2019

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.

@johnny-stevie
Copy link
Author

johnny-stevie commented Aug 17, 2019 via email

@johnny-stevie
Copy link
Author

johnny-stevie commented Aug 17, 2019 via email

@TheAssassin
Copy link
Member

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?

@wb9688
Copy link
Contributor

wb9688 commented Apr 19, 2020

@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.

@ghost
Copy link

ghost commented Dec 22, 2021

see Using Newpipe Extractor
it might help 😄

@Stypox
Copy link
Member

Stypox commented Dec 22, 2021

@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 ?)

@ghost
Copy link

ghost commented Dec 22, 2021

I am already working on this with @TobiGr, here 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants