add more info about linkhandler
This commit is contained in:
parent
528463feeb
commit
a3082783cf
|
@ -1,20 +1,22 @@
|
||||||
# Concept of LinkHandler
|
# Concept of LinkHandler
|
||||||
|
|
||||||
LinkHandler represent Links to resources like videos, search requests, channels, etc.
|
[LinkHandler](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/LinkHandler.html)
|
||||||
|
represent Links to resources like videos, search requests, channels, etc.
|
||||||
The idea behind them is that a video can have multiple links pointig to it, but it has
|
The idea behind them is that a video can have multiple links pointig to it, but it has
|
||||||
one unique id that represents it, like this example:
|
one unique id that represents it, like this example:
|
||||||
|
|
||||||
[oHg5SJYRHA0](https://www.youtube.com/watch?v=oHg5SJYRHA0) can be represented as:
|
[oHg5SJYRHA0](https://www.youtube.com/watch?v=oHg5SJYRHA0) can be represented as:
|
||||||
|
|
||||||
- [https://www.youtube.com/watch?v=oHg5SJYRHA0 (default url for youtube)](https://www.youtube.com/watch?v=oHg5SJYRHA0)
|
- https://www.youtube.com/watch?v=oHg5SJYRHA0 (default url for youtube)
|
||||||
- [https://youtu.be/oHg5SJYRHA0](https://www.youtube.com/watch?v=oHg5SJYRHA0)
|
- https://youtu.be/oHg5SJYRHA0
|
||||||
- [https://m.youtube.com/watch?v=oHg5SJYRHA0](https://www.youtube.com/watch?v=oHg5SJYRHA0)
|
- https://m.youtube.com/watch?v=oHg5SJYRHA0
|
||||||
|
|
||||||
### Importand notes about LinkHandler:
|
### Importand notes about LinkHandler:
|
||||||
- A simple `LinkHandler` will contain the default URL, the ID and the original url.
|
- A simple `LinkHandler` will contain the default URL, the ID and the original url.
|
||||||
- `LinkHandler` are ReadOnly
|
- `LinkHandler` are ReadOnly
|
||||||
- LinkHandler are also used to determine which part of the extractor can handle a certain link.
|
- LinkHandler are also used to determine which part of the extractor can handle a certain link.
|
||||||
- In order to get one you must either call [fromUrl()](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/LinkHandlerFactory.html#fromUrl-java.lang.String-) or [fromId()](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/LinkHandlerFactory.html#fromId-java.lang.String-) of the the coresponding `LinkHandlerFactory`.
|
- In order to get one you must either call
|
||||||
|
[fromUrl()](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/LinkHandlerFactory.html#fromUrl-java.lang.String-) or [fromId()](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/LinkHandlerFactory.html#fromId-java.lang.String-) of the the coresponding `LinkHandlerFactory`.
|
||||||
- Every type of Type of Resource has its own LinkHandlerFactory. Eg. YoutubeStreamLinkHandler, YoutubeChannelLinkHandler, etc.
|
- Every type of Type of Resource has its own LinkHandlerFactory. Eg. YoutubeStreamLinkHandler, YoutubeChannelLinkHandler, etc.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
@ -48,3 +50,15 @@ class MyStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ListLinkHandler and QueryLinkHandler
|
||||||
|
|
||||||
|
List based resources like channels and playlists can be sorted, for example by date, name, or by a certain name.
|
||||||
|
Therefore these type of resources don't just use a LinkHandler, but an extention called
|
||||||
|
[ListLinkHandler](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/ListLinkHandler.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue