42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
// Created by Fynn Godau 2019, licensed GNU GPL version 3 or later
|
|
|
|
package org.schabi.newpipe.extractor.services.bandcamp.linkHandler;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Just as with streams, the album ids are essentially useless for us.
|
|
*/
|
|
public class BandcampPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
|
|
@Override
|
|
public String getId(final String url) throws ParsingException {
|
|
return getUrl(url);
|
|
}
|
|
|
|
@Override
|
|
public String getUrl(final String url,
|
|
final List<String> contentFilter,
|
|
final String sortFilter) throws ParsingException {
|
|
return url;
|
|
}
|
|
|
|
/**
|
|
* Accepts all bandcamp URLs that contain /album/ behind their domain name.
|
|
*/
|
|
@Override
|
|
public boolean onAcceptUrl(final String url) throws ParsingException {
|
|
|
|
// Exclude URLs which do not lead to an album
|
|
if (!url.toLowerCase().matches("https?://.+\\..+/album/.+")) {
|
|
return false;
|
|
}
|
|
|
|
// Test whether domain is supported
|
|
return BandcampExtractorHelper.isSupportedDomain(url);
|
|
}
|
|
}
|