From 6822fe3dc8c1502c7dd83d0a0dcd6154ce505cfd Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Thu, 4 Jun 2020 13:03:16 +0200 Subject: [PATCH] Bandcamp: Get Stream upload date --- .../bandcamp/extractors/BandcampStreamExtractor.java | 2 +- .../services/bandcamp/BandcampStreamExtractorTest.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java index b6ed0a5da..b33670ecc 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampStreamExtractor.java @@ -96,7 +96,7 @@ public class BandcampStreamExtractor extends StreamExtractor { @Nullable @Override public String getTextualUploadDate() { - return current.getString("release_date"); + return current.getString("publish_date").replaceAll(" \\d+:\\d+:\\d+ .+", ""); } @Nullable diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java index c4d268226..c280bcb77 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampStreamExtractorTest.java @@ -60,6 +60,11 @@ public class BandcampStreamExtractorTest { assertTrue(url.contains("://f4.bcbits.com/img/") && url.endsWith(".jpg")); } + @Test + public void testUploadDate() { + assertEquals("27 Sep 2019", extractor.getTextualUploadDate()); + } + @Test public void testNoArtistProfilePicture() throws ExtractionException { assertEquals("", Bandcamp.getStreamExtractor("https://powertothequeerkids.bandcamp.com/track/human-nature").getUploaderAvatarUrl());