Deployed eb46671
with MkDocs version: 1.0.3
This commit is contained in:
parent
be692016fb
commit
fb247734d4
|
@ -140,17 +140,17 @@
|
|||
<div class="section">
|
||||
|
||||
<h1 id="implement-a-service">Implement a service</h1>
|
||||
<p>Services or better service connectors are the parts of NewPipe which communicative with an actual service like YouTube.
|
||||
<p>Services or better service connectors are the parts of NewPipe which communicate with an actual service like YouTube.
|
||||
This Page will describe how you can implement and add your own to the extractor. Please make sure you read and understand the
|
||||
<a href="https://teamnewpipe.github.io/documentation/01_Concept_of_the_extractor/">Concept of Extractors</a>
|
||||
and the <a href="https://teamnewpipe.github.io/documentation/02_Concept_of_LinkHandler/">Concept of LinkHandler</a>
|
||||
before doing this.</p>
|
||||
<h3 id="required-and-optional-parts">Required and optional parts</h3>
|
||||
<p>Please be aware that your extractor has to implement certain parts, but does not have to implement all.
|
||||
<p>Your service does not have to implement everything. Some parts are optional.
|
||||
This is because not all services support every feature other services support. For example, it might be that a certain
|
||||
service does not support channels. If so, you can leve out the implementation of channels, and make the corresponding
|
||||
factory methode of the your <strong>StreamingService</strong> implementation return <strong>null</strong>. The forntend will then automatically
|
||||
leave out these parts.</p>
|
||||
service does not support channels. If so, you can leave out the implementation of channels, and make the corresponding
|
||||
factory methode of the your <strong>StreamingService</strong> implementation return <strong>null</strong>. The forntend will handle the lack of
|
||||
having channels then.</p>
|
||||
<p>However if you start to implement one of the optional parts of the list below, you have to implement all parts/classes
|
||||
of it. NewPipe will crash if you only implement the extractor for the list item of a channel, but not the channel extractor itself.</p>
|
||||
<p><strong>The parts of a service:</strong></p>
|
||||
|
@ -177,7 +177,8 @@ ask us to introduce a new library than start using regex to often.</p>
|
|||
<p>If you need to introduce new libraries please tell us before you do it.</p>
|
||||
<h3 id="head-of-service">Head of Service</h3>
|
||||
<p>First of all if you want to create a new service you should create a new package below <code>org.schabi.newpipe.services</code>
|
||||
, with the name of your service as package name. Here you must put an implementation of these two classes:</p>
|
||||
, with the name of your service as package name.</p>
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/StreamingService.html">StreamingService</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/StreamingService.ServiceInfo.html">ServiceInfo</a></li>
|
||||
|
@ -197,12 +198,13 @@ of NewPipe. This way your service will become an official part of the NewPipe Ex
|
|||
Every service has an ID, which will be set when this list gets created. You need to set this ID by entering it in the constructor.
|
||||
So when adding your service just give it the ID of the previously last service in the list incremented by one.</p>
|
||||
<h3 id="stream">Stream</h3>
|
||||
<p>Streams are considered single entities of video or audio, the come along with metainformation like a title, a description,
|
||||
<p>Streams are considered single entities of video or audio, they come along with metainformation like a title, a description,
|
||||
next/related videos, thumbnail and commends. For getting the url to the actual stream data as well as this metainformation
|
||||
StreamExtractor is used. The LinkHandlerFactory will represent a link to such a stream. StreamInfoItemExtractor will
|
||||
extract one item in a list of items representing such Streams, like a search result or a playlist.
|
||||
Since every Streaming service (obviously) provides streams this is required to implement. Otherwise your service was
|
||||
pretty useless :)</p>
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/stream/StreamExtractor.html">StreamExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/stream/StreamInfoItemExtractor.html">StreamInfoItemExtractor</a></li>
|
||||
|
@ -212,6 +214,7 @@ pretty useless :)</p>
|
|||
<p>The SearchExtractor is also required to be implemented. It will take a search query represented as <a href="link here">SearchQueryHandler</a>,
|
||||
and return a list of search results. Since many services support a suggestion popup while you type you will also want to implement
|
||||
a <strong>SuggestionExtractor</strong>. This will make it possible for the frontend to as well display a suggestion while typing.</p>
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/search/SearchExtractor.html">SearchExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/SearchQueryHandlerFactory.html">SearchQueryHandlerFactory</a></li>
|
||||
|
@ -219,7 +222,8 @@ a <strong>SuggestionExtractor</strong>. This will make it possible for the front
|
|||
</ul>
|
||||
<h3 id="playlist">Playlist</h3>
|
||||
<p>Playlists are lists of streams provided by the service (you may not have to take care about locally saved playlists. This will be handled by the frontend).
|
||||
A playlist may only contains <strong>StreamItems</strong>, but no other <strong>InfoItem</strong> types.</p>
|
||||
A playlist may only contains <strong>StreamInfoItems</strong>, but no other <strong>InfoItem</strong> types.</p>
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.html">PlaylistExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/playlist/PlaylistExtractor.html">PlayListInfoItemExtractor</a></li>
|
||||
|
@ -229,14 +233,55 @@ A playlist may only contains <strong>StreamItems</strong>, but no other <strong>
|
|||
<p>A Channel is mostly a <a href="#playlist">Playlist</a>, the only diferens is that it does not represent a simple list of streams, but a
|
||||
user, a channel, or any entity that could be represented as a user. This is why the metadata supported by the channel extractor
|
||||
differs form the one of a playlist.</p>
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/channel/ChannelExtractor.html">ChannelExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/channel/ChannelExtractor.html">ChannelInfoItemExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.html">ListLinkHandlerFactory</a></li>
|
||||
</ul>
|
||||
<h3 id="kiosk">Kiosk</h3>
|
||||
<p>A kiosk is a list of <strong>InfoItems</strong> which will be displayed on the main page of NewPipe. A kiosk is mostly similar to the content
|
||||
displayed on the main page of a video platform. A kiosk could be something like "Top 20", "Charts", "News", "Creators selection" etc.
|
||||
Kiosk are controversial, many people may not like them. If you don't like them as well please don't refuse to add them thought.
|
||||
Your service would look pretty empty if you select it and no video is being displayed. Also you should not override the preference of the user,
|
||||
since users of NewPipe can decide by the settings weather they want to see the kiosk page or not.</p>
|
||||
<h4 id="multiple-kiosks">Multiple Kiosks</h4>
|
||||
<p>Most services will implement more than one Kiosk, so a service might have a "Top 20" for different categories like "Country Music", "Techno" ets.
|
||||
This is why the extractor will let you implement multiple <strong>KioskExtractors</strong>. Since different kiosk pages might also differ
|
||||
with their HTML structure every page you want to support has to be implemented as its own <strong>KioskExtractor</strong>.
|
||||
However if the pages are similar you can use the same Implementation, but set the page type when you instantiate your <strong>KioskExtractor</strong>
|
||||
through the <strong>KioskList.KioskExtractorFactory</strong>.</p>
|
||||
<p>Every Kiosk you implement needs to be added to your <strong>KioskList</strong> which you return with your
|
||||
<strong>StreamingService</strong> implementation.</p>
|
||||
<p>It is also important to set the default kiosk. This will be the kiosk that will be shown by the first start of your service.</p>
|
||||
<p>An example implementation of the
|
||||
<a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/StreamingService.html">getKioskList()</a>
|
||||
could look like this:</p>
|
||||
<pre><code class="java">@Override
|
||||
public KioskList getKioskList() throws ExtractionException {
|
||||
KioskList list = new KioskList(getServiceId());
|
||||
|
||||
list.addKioskEntry(new KioskList.KioskExtractorFactory() {
|
||||
@Override
|
||||
public KioskExtractor createNewKiosk(StreamingService streamingService,
|
||||
String url,
|
||||
String id,
|
||||
Localization local)
|
||||
throws ExtractionException {
|
||||
return new YoutubeTrendingExtractor(YoutubeService.this,
|
||||
new YoutubeTrendingLinkHandlerFactory().fromUrl(url), id, local);
|
||||
}
|
||||
}, new YoutubeTrendingLinkHandlerFactory(), "Trending");
|
||||
|
||||
list.setDefaultKiosk("Trending");
|
||||
return list;
|
||||
}
|
||||
|
||||
</code></pre>
|
||||
|
||||
<p><strong>Parts required to be implemented:</strong></p>
|
||||
<ul>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/kiosk/KioskList.KioskExtractorFactory.html">KioskExtractorFactory</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/kiosk/KioskList.KioskExtractorFactory.html">KioskList.KioskExtractorFactory</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/kiosk/KioskExtractor.html">KioskExtractor</a></li>
|
||||
<li><a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/linkhandler/ListLinkHandlerFactory.html">ListLinkHandlerFactory</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -181,5 +181,5 @@ It focuses on making it possible for the creator of a scraper for a streaming se
|
|||
|
||||
<!--
|
||||
MkDocs version : 1.0.3
|
||||
Build Date UTC : 2018-11-03 12:07:03
|
||||
Build Date UTC : 2018-11-03 13:58:34
|
||||
-->
|
||||
|
|
File diff suppressed because one or more lines are too long
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
Loading…
Reference in New Issue