Skip to content

Commit 176da72

Browse files
committed
Merge branch 'dev'
2 parents d39fc43 + 530c157 commit 176da72

File tree

434 files changed

+31368
-29291
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+31368
-29291
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: ./gradlew aggregatedJavadocs
3333

3434
- name: Deploy JavaDocs
35-
uses: peaceiris/actions-gh-pages@v3
35+
uses: peaceiris/actions-gh-pages@v4
3636
with:
3737
github_token: ${{ secrets.GITHUB_TOKEN }}
3838
publish_dir: ./build/docs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ If you're using Gradle, you could add NewPipe Extractor as a dependency with the
2121
-dontwarn org.mozilla.javascript.tools.**
2222
```
2323

24-
**Note:** To use NewPipe Extractor in Android projects with a `minSdk` below 26, [API desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) is required. If the `minSdk` is below 19, the `desugar_jdk_libs_nio` artifact is required, which requires Android Gradle Plugin (AGP) version 7.4.0.
24+
**Note:** To use NewPipe Extractor in Android projects with a `minSdk` below 33, [core library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) with the `desugar_jdk_libs_nio` artifact is required.
2525

2626
### Testing changes
2727

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ allprojects {
88
sourceCompatibility = JavaVersion.VERSION_11
99
targetCompatibility = JavaVersion.VERSION_11
1010

11-
version 'v0.24.0'
11+
version 'v0.24.2'
1212
group 'com.github.TeamNewPipe'
1313

1414
repositories {
@@ -28,8 +28,8 @@ allprojects {
2828

2929
ext {
3030
nanojsonVersion = "1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751"
31-
spotbugsVersion = "4.8.3"
32-
junitVersion = "5.10.2"
31+
spotbugsVersion = "4.8.6"
32+
junitVersion = "5.10.3"
3333
checkstyleVersion = "10.4"
3434
}
3535
}

extractor/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131

3232
// do not upgrade to 1.7.14, since in 1.7.14 Rhino uses the `SourceVersion` class, which is not
3333
// available on Android (even when using desugaring), and `NoClassDefFoundError` is thrown
34-
implementation 'org.mozilla:rhino:1.7.13'
34+
implementation 'org.mozilla:rhino:1.7.15'
3535

3636
checkstyle "com.puppycrawl.tools:checkstyle:$checkstyleVersion"
3737

@@ -41,5 +41,5 @@ dependencies {
4141
testImplementation 'org.junit.jupiter:junit-jupiter-params'
4242

4343
testImplementation "com.squareup.okhttp3:okhttp:3.12.13"
44-
testImplementation 'com.google.code.gson:gson:2.10.1'
44+
testImplementation 'com.google.code.gson:gson:2.11.0'
4545
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampExtractorHelper.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
1717
import org.schabi.newpipe.extractor.localization.DateWrapper;
1818
import org.schabi.newpipe.extractor.utils.ImageSuffix;
19+
import org.schabi.newpipe.extractor.utils.Utils;
1920

2021
import java.io.IOException;
2122
import java.nio.charset.StandardCharsets;
@@ -155,25 +156,34 @@ public static String getImageUrl(final long id, final boolean isAlbum) {
155156

156157
/**
157158
* @return <code>true</code> if the given URL looks like it comes from a bandcamp custom domain
158-
* or if it comes from <code>bandcamp.com</code> itself
159+
* or a <code>*.bandcamp.com</code> subdomain
159160
*/
160-
public static boolean isSupportedDomain(final String url) throws ParsingException {
161+
public static boolean isArtistDomain(final String url) throws ParsingException {
161162

162163
// Accept all bandcamp.com URLs
163164
if (url.toLowerCase().matches("https?://.+\\.bandcamp\\.com(/.*)?")) {
164165
return true;
165166
}
166167

168+
// Reject non-artist bandcamp.com URLs
169+
if (url.toLowerCase().matches("https?://bandcamp\\.com(/.*)?")) {
170+
return false;
171+
}
172+
167173
try {
168174
// Test other URLs for whether they contain a footer that links to bandcamp
169-
return Jsoup.parse(NewPipe.getDownloader().get(url).responseBody())
170-
.getElementById("pgFt")
171-
.getElementById("pgFt-inner")
172-
.getElementById("footer-logo-wrapper")
173-
.getElementById("footer-logo")
174-
.getElementsByClass("hiddenAccess")
175-
.text().equals("Bandcamp");
176-
} catch (final NullPointerException e) {
175+
return Jsoup.parse(
176+
NewPipe.getDownloader()
177+
.get(Utils.replaceHttpWithHttps(url))
178+
.responseBody()
179+
)
180+
.getElementsByClass("cart-wrapper")
181+
.get(0)
182+
.getElementsByTag("a")
183+
.get(0)
184+
.attr("href")
185+
.equals("https://bandcamp.com/cart");
186+
} catch (final NullPointerException | IndexOutOfBoundsException e) {
177187
return false;
178188
} catch (final IOException | ReCaptchaException e) {
179189
throw new ParsingException("Could not determine whether URL is custom domain "

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampRadioExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
public class BandcampRadioExtractor extends KioskExtractor<StreamInfoItem> {
2525

2626
public static final String KIOSK_RADIO = "Radio";
27-
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/1/list";
27+
public static final String RADIO_API_URL = BASE_API_URL + "/bcweekly/3/list";
2828

2929
private JsonObject json = null;
3030

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampRadioInfoItemExtractor.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public long getDuration() {
3535
return 0;
3636
}
3737

38+
@Nullable
39+
@Override
40+
public String getShortDescription() {
41+
return show.getString("desc");
42+
}
43+
3844
@Nullable
3945
@Override
4046
public String getTextualUploadDate() {
@@ -75,8 +81,8 @@ public long getViewCount() {
7581

7682
@Override
7783
public String getUploaderName() {
78-
// JSON does not contain uploader name
79-
return "";
84+
// The "title" field contains the title of the series, e.g. "Bandcamp Weekly".
85+
return show.getString("title");
8086
}
8187

8288
@Override

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/streaminfoitem/BandcampPlaylistStreamInfoItemExtractor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public String getName() {
4343

4444
@Override
4545
public String getUrl() {
46-
return getUploaderUrl() + track.getString("title_link");
46+
final String relativeUrl = track.getString("title_link");
47+
if (relativeUrl != null) {
48+
return getUploaderUrl() + relativeUrl;
49+
} else {
50+
return null;
51+
}
4752
}
4853

4954
@Override
@@ -66,7 +71,7 @@ public String getUploaderName() {
6671
@Nonnull
6772
@Override
6873
public List<Image> getThumbnails() throws ParsingException {
69-
if (substituteCovers.isEmpty()) {
74+
if (substituteCovers.isEmpty() && getUrl() != null) {
7075
try {
7176
final StreamExtractor extractor = service.getStreamExtractor(getUrl());
7277
extractor.fetchPage();

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampChannelLinkHandlerFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public static BandcampChannelLinkHandlerFactory getInstance() {
3333
@Override
3434
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
3535
try {
36-
final String response = NewPipe.getDownloader().get(url).responseBody();
36+
final String response = NewPipe.getDownloader().get(Utils.replaceHttpWithHttps(url))
37+
.responseBody();
3738

3839
// Use band data embedded in website to extract ID
3940
final JsonObject bandData = JsonUtils.getJsonData(response, "data-band");
@@ -90,7 +91,7 @@ public boolean onAcceptUrl(final String url) throws ParsingException {
9091
}
9192

9293
// Test whether domain is supported
93-
return BandcampExtractorHelper.isSupportedDomain(lowercaseUrl);
94+
return BandcampExtractorHelper.isArtistDomain(lowercaseUrl);
9495
}
9596
}
9697
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampCommentsLinkHandlerFactory.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.schabi.newpipe.extractor.exceptions.ParsingException;
44
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
55
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
6+
import org.schabi.newpipe.extractor.utils.Utils;
67

78
import java.util.List;
89

@@ -24,7 +25,7 @@ public static BandcampCommentsLinkHandlerFactory getInstance() {
2425

2526
@Override
2627
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
27-
return url;
28+
return Utils.replaceHttpWithHttps(url);
2829
}
2930

3031
@Override
@@ -39,14 +40,14 @@ public boolean onAcceptUrl(final String url) throws ParsingException {
3940
}
4041

4142
// Test whether domain is supported
42-
return BandcampExtractorHelper.isSupportedDomain(url);
43+
return BandcampExtractorHelper.isArtistDomain(url);
4344
}
4445

4546
@Override
4647
public String getUrl(final String id,
4748
final List<String> contentFilter,
4849
final String sortFilter)
4950
throws ParsingException, UnsupportedOperationException {
50-
return id;
51+
return Utils.replaceHttpWithHttps(id);
5152
}
5253
}

0 commit comments

Comments
 (0)