Skip to content

Commit 7884e32

Browse files
authored
Merge branch 'TeamNewPipe:dev' into feat/yt/featured-channels
2 parents 740992a + 1ddc27c commit 7884e32

15 files changed

Lines changed: 748 additions & 45 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
-Dcom.google.protobuf.error_on_unsafe_pre22_gencode
6464
6565
- name: Upload test reports when failure occurs
66-
uses: actions/upload-artifact@v6
66+
uses: actions/upload-artifact@v7
6767
if: failure()
6868
with:
6969
name: NewPipeExtractor-test-reports

.github/workflows/snapshot.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy-docs:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
15+
- name: set up JDK
16+
uses: actions/setup-java@v5
17+
with:
18+
java-version: 21
19+
distribution: 'temurin'
20+
21+
- name: Cache Gradle dependencies
22+
uses: actions/cache@v5
23+
with:
24+
path: ~/.gradle/caches
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
26+
restore-keys: ${{ runner.os }}-gradle
27+
28+
- name: Publish snapshot
29+
env:
30+
PGP_PRIVATE_SIGNING_KEY: ${{ secrets.PGP_PRIVATE_SIGNING_KEY }}
31+
PGP_PRIVATE_SIGNING_KEY_PASSWORD: ${{ secrets.PGP_PRIVATE_SIGNING_KEY_PASSWORD }}
32+
SONATYPE_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_USERNAME }}
33+
SONATYPE_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PASSWORD }}
34+
run: ./gradlew publishSnapshotPublicationToSonatypeRepository
35+
36+
- name: Upload metadata
37+
uses: actions/upload-artifact@v7
38+
with:
39+
name: NewPipeExtractor-Snapshot
40+
path: extractor/build/publications/snapshot/**

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ If you're using Gradle, you could add NewPipe Extractor as a dependency with the
2525
2626
### Testing changes
2727

28+
#### Maven Central
29+
30+
NewPipe Extractor's snapshots are available on Maven Central's snapshot repository. These versions
31+
are based on the commit's short hash (for e.g. `git rev-parse --short HEAD`) and are available for
32+
90 days since the date of publication/commit.
33+
34+
```kotlin
35+
repositories {
36+
maven(url = "https://central.sonatype.com/repository/maven-snapshots/")
37+
}
38+
39+
dependencies {
40+
implementation("net.newpipe:extractor:${LAST_COMMIT_SHORT_HASH}-SNAPSHOT")
41+
}
42+
```
43+
44+
#### Local
45+
2846
To test changes quickly you can build the library locally. A good approach would be to add something like the following to your `settings.gradle`:
2947

3048
```groovy

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
allprojects {
1111
apply(plugin = "java-library")
1212

13-
version = "v0.25.2"
13+
version = "v0.26.0"
1414

1515
tasks.withType<JavaCompile> {
1616
options.encoding = Charsets.UTF_8.toString()

extractor/build.gradle.kts

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@
66
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
77
import org.gradle.api.tasks.testing.logging.TestLogEvent
88

9+
val ciSigningKey: String? = System.getenv("PGP_PRIVATE_SIGNING_KEY")
10+
val ciSigningPassword: String? = System.getenv("PGP_PRIVATE_SIGNING_KEY_PASSWORD")
11+
val shouldSignCIRelease: Boolean
12+
get() = !ciSigningKey.isNullOrEmpty() && !ciSigningPassword.isNullOrEmpty()
13+
14+
val lastCommitHash: String = providers.exec {
15+
commandLine("git", "rev-parse", "--short", "HEAD")
16+
}.standardOutput.asText.map { it.trim() }.get()
17+
918
plugins {
1019
alias(libs.plugins.google.protobuf)
1120
checkstyle
1221
`maven-publish`
22+
signing
1323
}
1424

1525
java {
@@ -112,47 +122,79 @@ protobuf {
112122
// Run "./gradlew publishReleasePublicationToLocalRepository" to generate release JARs locally
113123
publishing {
114124
publications {
125+
val mavenGroupId = "net.newpipe"
126+
val mavenArtifactId = "extractor"
127+
fun MavenPublication.setupPOM() = pom {
128+
name = "NewPipe Extractor"
129+
description = "A library for extracting data from streaming websites, used in NewPipe"
130+
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
131+
132+
licenses {
133+
license {
134+
name = "GNU GENERAL PUBLIC LICENSE, Version 3"
135+
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
136+
}
137+
}
138+
139+
scm {
140+
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
141+
connection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
142+
developerConnection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
143+
}
144+
145+
developers {
146+
developer {
147+
id = "newpipe"
148+
name = "Team NewPipe"
149+
email = "team@newpipe.net"
150+
}
151+
}
152+
}
153+
115154
create<MavenPublication>("release") {
116-
groupId = "net.newpipe"
117-
artifactId = "extractor"
155+
groupId = mavenGroupId
156+
artifactId = mavenArtifactId
118157
version = rootProject.version.toString()
119158

120159
afterEvaluate {
121160
from(components["java"])
122161
}
123162

124-
pom {
125-
name = "NewPipe Extractor"
126-
description = "A library for extracting data from streaming websites, used in NewPipe"
127-
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
128-
129-
licenses {
130-
license {
131-
name = "GNU GENERAL PUBLIC LICENSE, Version 3"
132-
url = "https://www.gnu.org/licenses/gpl-3.0.txt"
133-
}
134-
}
135-
136-
scm {
137-
url = "https://github.com/TeamNewPipe/NewPipeExtractor"
138-
connection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
139-
developerConnection = "scm:git:git@github.com:TeamNewPipe/NewPipeExtractor.git"
140-
}
163+
setupPOM()
164+
}
165+
create<MavenPublication>("snapshot") {
166+
groupId = mavenGroupId
167+
artifactId = mavenArtifactId
168+
version = "$lastCommitHash-SNAPSHOT"
141169

142-
developers {
143-
developer {
144-
id = "newpipe"
145-
name = "Team NewPipe"
146-
email = "team@newpipe.net"
147-
}
148-
}
170+
afterEvaluate {
171+
from(components["java"])
149172
}
173+
174+
setupPOM()
150175
}
151176
repositories {
177+
maven {
178+
name = "sonatype"
179+
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
180+
credentials {
181+
username = System.getenv("SONATYPE_MAVEN_CENTRAL_USERNAME")
182+
password = System.getenv("SONATYPE_MAVEN_CENTRAL_PASSWORD")
183+
}
184+
}
152185
maven {
153186
name = "local"
154187
url = uri(layout.buildDirectory.dir("maven"))
155188
}
156189
}
157190
}
158191
}
192+
193+
signing {
194+
useInMemoryPgpKeys(ciSigningKey, ciSigningPassword)
195+
sign(publishing.publications["snapshot"])
196+
}
197+
198+
tasks.withType<Sign> {
199+
onlyIf("Signing credentials are present (only used for maven central)") { shouldSignCIRelease }
200+
}

extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.annotation.Nullable;
2929
import java.util.Collections;
3030
import java.util.List;
31+
import java.util.Set;
3132

3233
/*
3334
* Copyright (C) 2018 Christian Schabesberger <chris.schabesberger@mailbox.org>
@@ -55,23 +56,23 @@ public abstract class StreamingService {
5556
public static class ServiceInfo {
5657
private final String name;
5758

58-
private final List<MediaCapability> mediaCapabilities;
59+
private final Set<MediaCapability> mediaCapabilities;
5960

6061
/**
6162
* Creates a new instance of a ServiceInfo
6263
* @param name the name of the service
6364
* @param mediaCapabilities the type of media this service can handle
6465
*/
65-
public ServiceInfo(final String name, final List<MediaCapability> mediaCapabilities) {
66+
public ServiceInfo(final String name, final Set<MediaCapability> mediaCapabilities) {
6667
this.name = name;
67-
this.mediaCapabilities = Collections.unmodifiableList(mediaCapabilities);
68+
this.mediaCapabilities = mediaCapabilities;
6869
}
6970

7071
public String getName() {
7172
return name;
7273
}
7374

74-
public List<MediaCapability> getMediaCapabilities() {
75+
public Set<MediaCapability> getMediaCapabilities() {
7576
return mediaCapabilities;
7677
}
7778

@@ -105,7 +106,7 @@ public enum LinkType {
105106
*/
106107
public StreamingService(final int id,
107108
final String name,
108-
final List<ServiceInfo.MediaCapability> capabilities) {
109+
final Set<ServiceInfo.MediaCapability> capabilities) {
109110
this.serviceId = id;
110111
this.serviceInfo = new ServiceInfo(name, capabilities);
111112
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/BandcampService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
4949
import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
5050

51-
import java.util.Arrays;
51+
import java.util.EnumSet;
5252

5353
public class BandcampService extends StreamingService {
5454

5555
public BandcampService(final int id) {
56-
super(id, "Bandcamp", Arrays.asList(AUDIO, COMMENTS));
56+
super(id, "Bandcamp", EnumSet.of(AUDIO, COMMENTS));
5757
}
5858

5959
@Override

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
44
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.VIDEO;
5-
import static java.util.Arrays.asList;
65

76
import org.schabi.newpipe.extractor.StreamingService;
87
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -39,9 +38,11 @@
3938
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
4039
import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
4140

41+
import java.util.EnumSet;
42+
4243
public class MediaCCCService extends StreamingService {
4344
public MediaCCCService(final int id) {
44-
super(id, "media.ccc.de", asList(AUDIO, VIDEO));
45+
super(id, "media.ccc.de", EnumSet.of(AUDIO, VIDEO));
4546
}
4647

4748
@Override

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
44
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.VIDEO;
5-
import static java.util.Arrays.asList;
65

76
import org.schabi.newpipe.extractor.StreamingService;
87
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -39,6 +38,7 @@
3938
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
4039
import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor;
4140

41+
import java.util.EnumSet;
4242
import java.util.List;
4343

4444
public class PeertubeService extends StreamingService {
@@ -50,7 +50,7 @@ public PeertubeService(final int id) {
5050
}
5151

5252
public PeertubeService(final int id, final PeertubeInstance instance) {
53-
super(id, "PeerTube", asList(VIDEO, COMMENTS));
53+
super(id, "PeerTube", EnumSet.of(VIDEO, COMMENTS));
5454
this.instance = instance;
5555
}
5656

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
44
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
5-
import static java.util.Arrays.asList;
65

76
import org.schabi.newpipe.extractor.StreamingService;
87
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@@ -39,12 +38,13 @@
3938
import org.schabi.newpipe.extractor.stream.StreamExtractor;
4039
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
4140

41+
import java.util.EnumSet;
4242
import java.util.List;
4343

4444
public class SoundcloudService extends StreamingService {
4545

4646
public SoundcloudService(final int id) {
47-
super(id, "SoundCloud", asList(AUDIO, COMMENTS));
47+
super(id, "SoundCloud", EnumSet.of(AUDIO, COMMENTS));
4848
}
4949

5050
@Override

0 commit comments

Comments
 (0)