Merge pull request #1031 from petlyh/bandcamp-fix-radio-comments
[Bandcamp] Show comments as disabled on radio streams
This commit is contained in:
commit
3fdb6ee476
|
@ -53,4 +53,9 @@ public class BandcampCommentsExtractor extends CommentsExtractor {
|
||||||
throws IOException, ExtractionException {
|
throws IOException, ExtractionException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCommentsDisabled() throws ExtractionException {
|
||||||
|
return BandcampExtractorHelper.isRadioUrl(getUrl());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,10 @@ public class BandcampCommentsLinkHandlerFactory extends ListLinkHandlerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onAcceptUrl(final String url) throws ParsingException {
|
public boolean onAcceptUrl(final String url) throws ParsingException {
|
||||||
|
if (BandcampExtractorHelper.isRadioUrl(url)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't accept URLs that don't point to a track
|
// Don't accept URLs that don't point to a track
|
||||||
if (!url.toLowerCase().matches("https?://.+\\..+/(track|album)/.+")) {
|
if (!url.toLowerCase().matches("https?://.+\\..+/(track|album)/.+")) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -32,8 +32,8 @@ public class BandcampCommentsLinkHandlerFactoryTest {
|
||||||
assertFalse(linkHandler.acceptUrl("https://bandcamp.com"));
|
assertFalse(linkHandler.acceptUrl("https://bandcamp.com"));
|
||||||
assertFalse(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/"));
|
assertFalse(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/"));
|
||||||
assertFalse(linkHandler.acceptUrl("https://example.com/track/sampletrack"));
|
assertFalse(linkHandler.acceptUrl("https://example.com/track/sampletrack"));
|
||||||
assertFalse(linkHandler.acceptUrl("http://bandcamP.com/?show=38"));
|
|
||||||
|
|
||||||
|
assertTrue(linkHandler.acceptUrl("http://bandcamP.com/?show=38"));
|
||||||
assertTrue(linkHandler.acceptUrl("https://powertothequeerkids.bandcamp.com/album/power-to-the-queer-kids"));
|
assertTrue(linkHandler.acceptUrl("https://powertothequeerkids.bandcamp.com/album/power-to-the-queer-kids"));
|
||||||
assertTrue(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/track/kitchen"));
|
assertTrue(linkHandler.acceptUrl("https://zachbenson.bandcamp.com/track/kitchen"));
|
||||||
assertTrue(linkHandler.acceptUrl("http://ZachBenson.Bandcamp.COM/Track/U-I-Tonite/"));
|
assertTrue(linkHandler.acceptUrl("http://ZachBenson.Bandcamp.COM/Track/U-I-Tonite/"));
|
||||||
|
|
Loading…
Reference in New Issue