mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-01-07 18:10:34 +05:30
Fix "Could not get id" for channels w/o "Subscribe" button
This commit is contained in:
parent
94e7f0d3ab
commit
db3596c818
@ -82,6 +82,11 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getId() throws ParsingException {
|
public String getId() throws ParsingException {
|
||||||
|
try {
|
||||||
|
return doc.select("meta[itemprop=\"channelId\"]").first().attr("content");
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
|
||||||
|
// fallback method; does not work with channels that have no "Subscribe" button (e.g. EminemVEVO)
|
||||||
try {
|
try {
|
||||||
Element element = doc.getElementsByClass("yt-uix-subscription-button").first();
|
Element element = doc.getElementsByClass("yt-uix-subscription-button").first();
|
||||||
if (element == null) element = doc.getElementsByClass("yt-uix-subscription-preferences-button").first();
|
if (element == null) element = doc.getElementsByClass("yt-uix-subscription-preferences-button").first();
|
||||||
|
Loading…
Reference in New Issue
Block a user