2017-03-01 18:47:52 +01:00
|
|
|
package org.schabi.newpipe.extractor.services.youtube;
|
|
|
|
|
2023-12-30 08:43:06 +01:00
|
|
|
import org.schabi.newpipe.extractor.search.filter.FilterItem;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.search.filter.YoutubeFilters;
|
|
|
|
|
2022-03-18 15:09:06 +01:00
|
|
|
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
|
|
|
|
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
|
|
|
|
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.LIVE;
|
|
|
|
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.VIDEO;
|
|
|
|
import static java.util.Arrays.asList;
|
|
|
|
|
2018-08-20 00:52:19 +02:00
|
|
|
import org.schabi.newpipe.extractor.StreamingService;
|
2017-08-11 20:21:49 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabExtractor;
|
2018-08-20 00:52:19 +02:00
|
|
|
import org.schabi.newpipe.extractor.comments.CommentsExtractor;
|
2017-03-01 18:47:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
2019-12-16 08:35:44 +01:00
|
|
|
import org.schabi.newpipe.extractor.feed.FeedExtractor;
|
2017-08-12 17:29:28 +02:00
|
|
|
import org.schabi.newpipe.extractor.kiosk.KioskList;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.linkhandler.LinkHandler;
|
|
|
|
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
|
|
|
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
|
|
|
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
import org.schabi.newpipe.extractor.linkhandler.ReadyChannelTabListLinkHandler;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandler;
|
|
|
|
import org.schabi.newpipe.extractor.linkhandler.SearchQueryHandlerFactory;
|
2019-04-28 22:03:16 +02:00
|
|
|
import org.schabi.newpipe.extractor.localization.ContentCountry;
|
|
|
|
import org.schabi.newpipe.extractor.localization.Localization;
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
2018-05-13 21:28:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.search.SearchExtractor;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelExtractor;
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeChannelTabExtractor;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeCommentsExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeFeedExtractor;
|
2020-05-21 14:52:13 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMixPlaylistExtractor;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeMusicSearchExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubePlaylistExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSearchExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSubscriptionExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSuggestionExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeTrendingExtractor;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelLinkHandlerFactory;
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeChannelTabLinkHandlerFactory;
|
2020-04-01 10:03:54 +02:00
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeCommentsLinkHandlerFactory;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubePlaylistLinkHandlerFactory;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeStreamLinkHandlerFactory;
|
|
|
|
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeTrendingLinkHandlerFactory;
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
2018-02-22 15:52:38 +01:00
|
|
|
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
|
2019-04-28 22:03:16 +02:00
|
|
|
import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
|
2023-12-30 08:43:06 +01:00
|
|
|
import org.schabi.newpipe.extractor.utils.Utils;
|
2017-03-01 18:47:52 +01:00
|
|
|
|
2020-02-08 23:58:46 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2020-04-01 10:03:54 +02:00
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
/*
|
2017-03-01 18:47:52 +01:00
|
|
|
* Created by Christian Schabesberger on 23.08.15.
|
|
|
|
*
|
2023-09-23 00:10:15 +02:00
|
|
|
* Copyright (C) 2018 Christian Schabesberger <chris.schabesberger@mailbox.org>
|
|
|
|
* YoutubeService.java is part of NewPipe Extractor.
|
2017-03-01 18:47:52 +01:00
|
|
|
*
|
2023-09-23 00:10:15 +02:00
|
|
|
* NewPipe Extractor is free software: you can redistribute it and/or modify
|
2017-03-01 18:47:52 +01:00
|
|
|
* 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.
|
|
|
|
*
|
2023-09-23 00:10:15 +02:00
|
|
|
* NewPipe Extractor is distributed in the hope that it will be useful,
|
2017-03-01 18:47:52 +01:00
|
|
|
* 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
|
2023-09-23 00:10:15 +02:00
|
|
|
* along with NewPipe Extractor. If not, see <http://www.gnu.org/licenses/>.
|
2017-03-01 18:47:52 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
public class YoutubeService extends StreamingService {
|
|
|
|
|
2022-03-18 15:09:06 +01:00
|
|
|
public YoutubeService(final int id) {
|
2019-02-15 20:27:00 +01:00
|
|
|
super(id, "YouTube", asList(AUDIO, VIDEO, LIVE, COMMENTS));
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-11-19 22:38:17 +01:00
|
|
|
public String getBaseUrl() {
|
|
|
|
return "https://youtube.com";
|
2018-05-13 21:28:51 +02:00
|
|
|
}
|
2019-12-16 08:35:44 +01:00
|
|
|
|
2017-03-01 18:47:52 +01:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public LinkHandlerFactory getStreamLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return YoutubeStreamLinkHandlerFactory.getInstance();
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public ListLinkHandlerFactory getChannelLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return YoutubeChannelLinkHandlerFactory.getInstance();
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
@Override
|
|
|
|
public ListLinkHandlerFactory getChannelTabLHFactory() {
|
|
|
|
return YoutubeChannelTabLinkHandlerFactory.getInstance();
|
|
|
|
}
|
|
|
|
|
2017-03-12 16:15:51 +01:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public ListLinkHandlerFactory getPlaylistLHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return YoutubePlaylistLinkHandlerFactory.getInstance();
|
2017-03-12 16:15:51 +01:00
|
|
|
}
|
|
|
|
|
2018-05-26 19:15:45 +02:00
|
|
|
@Override
|
2018-08-05 14:14:36 +02:00
|
|
|
public SearchQueryHandlerFactory getSearchQHFactory() {
|
2018-07-13 18:02:40 +02:00
|
|
|
return YoutubeSearchQueryHandlerFactory.getInstance();
|
2018-05-26 19:15:45 +02:00
|
|
|
}
|
|
|
|
|
2017-08-06 22:20:15 +02:00
|
|
|
@Override
|
2022-03-18 15:09:06 +01:00
|
|
|
public StreamExtractor getStreamExtractor(final LinkHandler linkHandler) {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new YoutubeStreamExtractor(this, linkHandler);
|
2017-08-06 22:20:15 +02:00
|
|
|
}
|
|
|
|
|
2017-03-01 18:47:52 +01:00
|
|
|
@Override
|
2022-03-18 15:09:06 +01:00
|
|
|
public ChannelExtractor getChannelExtractor(final ListLinkHandler linkHandler) {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new YoutubeChannelExtractor(this, linkHandler);
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
@Override
|
|
|
|
public ChannelTabExtractor getChannelTabExtractor(final ListLinkHandler linkHandler) {
|
|
|
|
if (linkHandler instanceof ReadyChannelTabListLinkHandler) {
|
|
|
|
return ((ReadyChannelTabListLinkHandler) linkHandler).getChannelTabExtractor(this);
|
|
|
|
} else {
|
|
|
|
return new YoutubeChannelTabExtractor(this, linkHandler);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
@Override
|
2020-04-16 19:28:27 +02:00
|
|
|
public PlaylistExtractor getPlaylistExtractor(final ListLinkHandler linkHandler) {
|
2023-01-15 23:28:59 +01:00
|
|
|
if (YoutubeParsingHelper.isYoutubeMixId(linkHandler.getId())) {
|
2020-02-02 14:19:48 +01:00
|
|
|
return new YoutubeMixPlaylistExtractor(this, linkHandler);
|
|
|
|
} else {
|
|
|
|
return new YoutubePlaylistExtractor(this, linkHandler);
|
|
|
|
}
|
2017-03-12 16:15:51 +01:00
|
|
|
}
|
|
|
|
|
2017-03-01 18:47:52 +01:00
|
|
|
@Override
|
2022-03-18 15:09:06 +01:00
|
|
|
public SearchExtractor getSearchExtractor(final SearchQueryHandler query) {
|
2023-12-30 08:43:06 +01:00
|
|
|
final FilterItem filterItem =
|
|
|
|
Utils.getFirstContentFilterItem(query);
|
2020-04-01 10:03:54 +02:00
|
|
|
|
2023-12-30 08:43:06 +01:00
|
|
|
if (filterItem instanceof YoutubeFilters.MusicYoutubeContentFilterItem) {
|
2020-04-01 10:03:54 +02:00
|
|
|
return new YoutubeMusicSearchExtractor(this, query);
|
|
|
|
} else {
|
|
|
|
return new YoutubeSearchExtractor(this, query);
|
|
|
|
}
|
2019-04-28 22:03:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public SuggestionExtractor getSuggestionExtractor() {
|
|
|
|
return new YoutubeSuggestionExtractor(this);
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
@Override
|
2018-10-05 16:01:10 +02:00
|
|
|
public KioskList getKioskList() throws ExtractionException {
|
2022-03-18 15:09:06 +01:00
|
|
|
final KioskList list = new KioskList(this);
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
final ListLinkHandlerFactory h = YoutubeTrendingLinkHandlerFactory.getInstance();
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
// add kiosks here e.g.:
|
2017-08-12 21:10:21 +02:00
|
|
|
try {
|
2022-03-18 15:09:06 +01:00
|
|
|
list.addKioskEntry(
|
|
|
|
(streamingService, url, id) -> new YoutubeTrendingExtractor(
|
|
|
|
YoutubeService.this,
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
h.fromUrl(url),
|
2022-03-18 15:09:06 +01:00
|
|
|
id
|
|
|
|
),
|
[YouTube] Add support for channel tabs and tags and age-restricted channels
Support of tags and videos, shorts, live, playlists and channels tabs has been
added for non-age restricted channels.
Age-restricted channels are now also supported and always returned the videos,
shorts and live tabs, accessible using system playlists. These tabs are the
only ones which can be accessed using YouTube's desktop website without being
logged-in.
The videos channel tab parameter has been updated to the one used by the
desktop website and when a channel extraction is fetched, this tab is returned
in the list of tabs as a cached one in the corresponding link handler.
Visitor data support per request has been added, as a valid visitor data is
required to fetch continuations with contents on the shorts tab. It is only
used in this case to enhance privacy.
A dedicated shorts UI elements (reelItemRenderers) extractor has been added,
YoutubeReelInfoItemExtractor. These elements do not provide the exact view
count, any uploader info (name, URL, avatar, verified status) and the upload
date.
All service's LinkHandlers are now using the singleton pattern and some code
has been also improved on the files changed.
Co-authored-by: ThetaDev <t.testboy@gmail.com>
Co-authored-by: Stypox <stypox@pm.me>
2023-07-14 23:46:48 +02:00
|
|
|
h,
|
2023-08-05 03:10:51 +02:00
|
|
|
YoutubeTrendingExtractor.KIOSK_ID
|
2022-03-18 15:09:06 +01:00
|
|
|
);
|
2023-08-05 03:10:51 +02:00
|
|
|
list.setDefaultKiosk(YoutubeTrendingExtractor.KIOSK_ID);
|
2022-03-18 15:09:06 +01:00
|
|
|
} catch (final Exception e) {
|
2017-08-12 21:10:21 +02:00
|
|
|
throw new ExtractionException(e);
|
|
|
|
}
|
2017-08-12 17:29:28 +02:00
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
2018-02-22 15:52:38 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public SubscriptionExtractor getSubscriptionExtractor() {
|
|
|
|
return new YoutubeSubscriptionExtractor(this);
|
|
|
|
}
|
|
|
|
|
2019-12-16 08:35:44 +01:00
|
|
|
@Nonnull
|
|
|
|
@Override
|
|
|
|
public FeedExtractor getFeedExtractor(final String channelUrl) throws ExtractionException {
|
|
|
|
return new YoutubeFeedExtractor(this, getChannelLHFactory().fromUrl(channelUrl));
|
|
|
|
}
|
|
|
|
|
2018-12-28 08:32:00 +01:00
|
|
|
@Override
|
|
|
|
public ListLinkHandlerFactory getCommentsLHFactory() {
|
|
|
|
return YoutubeCommentsLinkHandlerFactory.getInstance();
|
|
|
|
}
|
2018-08-20 00:52:19 +02:00
|
|
|
|
2018-12-28 08:32:00 +01:00
|
|
|
@Override
|
2022-03-18 15:09:06 +01:00
|
|
|
public CommentsExtractor getCommentsExtractor(final ListLinkHandler urlIdHandler)
|
2018-12-28 08:32:00 +01:00
|
|
|
throws ExtractionException {
|
2019-04-28 22:03:16 +02:00
|
|
|
return new YoutubeCommentsExtractor(this, urlIdHandler);
|
2018-12-28 08:32:00 +01:00
|
|
|
}
|
2018-08-20 00:52:19 +02:00
|
|
|
|
2019-04-28 22:03:16 +02:00
|
|
|
/*//////////////////////////////////////////////////////////////////////////
|
|
|
|
// Localization
|
|
|
|
//////////////////////////////////////////////////////////////////////////*/
|
|
|
|
|
|
|
|
// https://www.youtube.com/picker_ajax?action_language_json=1
|
|
|
|
private static final List<Localization> SUPPORTED_LANGUAGES = Localization.listFrom(
|
2019-10-02 07:03:06 +02:00
|
|
|
"en-GB"
|
|
|
|
/*"af", "am", "ar", "az", "be", "bg", "bn", "bs", "ca", "cs", "da", "de",
|
2019-04-28 22:03:16 +02:00
|
|
|
"el", "en", "en-GB", "es", "es-419", "es-US", "et", "eu", "fa", "fi", "fil", "fr",
|
|
|
|
"fr-CA", "gl", "gu", "hi", "hr", "hu", "hy", "id", "is", "it", "iw", "ja",
|
|
|
|
"ka", "kk", "km", "kn", "ko", "ky", "lo", "lt", "lv", "mk", "ml", "mn",
|
|
|
|
"mr", "ms", "my", "ne", "nl", "no", "pa", "pl", "pt", "pt-PT", "ro", "ru",
|
|
|
|
"si", "sk", "sl", "sq", "sr", "sr-Latn", "sv", "sw", "ta", "te", "th", "tr",
|
2019-10-02 07:03:06 +02:00
|
|
|
"uk", "ur", "uz", "vi", "zh-CN", "zh-HK", "zh-TW", "zu"*/
|
2019-04-28 22:03:16 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// https://www.youtube.com/picker_ajax?action_country_json=1
|
|
|
|
private static final List<ContentCountry> SUPPORTED_COUNTRIES = ContentCountry.listFrom(
|
2022-11-26 20:01:33 +01:00
|
|
|
"DZ", "AR", "AU", "AT", "AZ", "BH", "BD", "BY", "BE", "BO", "BA", "BR", "BG", "KH",
|
|
|
|
"CA", "CL", "CO", "CR", "HR", "CY", "CZ", "DK", "DO", "EC", "EG", "SV", "EE", "FI",
|
|
|
|
"FR", "GE", "DE", "GH", "GR", "GT", "HN", "HK", "HU", "IS", "IN", "ID", "IQ", "IE",
|
|
|
|
"IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KW", "LA", "LV", "LB", "LY", "LI", "LT",
|
|
|
|
"LU", "MY", "MT", "MX", "ME", "MA", "NP", "NL", "NZ", "NI", "NG", "MK", "NO", "OM",
|
|
|
|
"PK", "PA", "PG", "PY", "PE", "PH", "PL", "PT", "PR", "QA", "RO", "RU", "SA", "SN",
|
|
|
|
"RS", "SG", "SK", "SI", "ZA", "KR", "ES", "LK", "SE", "CH", "TW", "TZ", "TH", "TN",
|
|
|
|
"TR", "UG", "UA", "AE", "GB", "US", "UY", "VE", "VN", "YE", "ZW"
|
2019-04-28 22:03:16 +02:00
|
|
|
);
|
|
|
|
|
2018-10-11 21:10:22 +02:00
|
|
|
@Override
|
2019-04-28 22:03:16 +02:00
|
|
|
public List<Localization> getSupportedLocalizations() {
|
|
|
|
return SUPPORTED_LANGUAGES;
|
2018-10-11 21:10:22 +02:00
|
|
|
}
|
|
|
|
|
2021-03-30 10:10:45 +02:00
|
|
|
@Override
|
2019-04-28 22:03:16 +02:00
|
|
|
public List<ContentCountry> getSupportedCountries() {
|
|
|
|
return SUPPORTED_COUNTRIES;
|
|
|
|
}
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|