Skip to content

Commit 78c2113

Browse files
committed
Merge remote-tracking branch 'origin/dev' into bandcamp
2 parents c9e9953 + b9ba956 commit 78c2113

150 files changed

Lines changed: 4468 additions & 348 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
build-and-test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: set up JDK 1.8
17+
uses: actions/setup-java@v1.4.3
18+
with:
19+
java-version: 1.8
20+
21+
- name: Cache Gradle dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.gradle/caches
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
26+
restore-keys: ${{ runner.os }}-gradle
27+
28+
- name: Build and run Tests
29+
run: ./gradlew check --stacktrace -Ddownloader=MOCK

.github/workflows/docs.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and deploy JavaDocs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-and-deploy-docs:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: set up JDK 1.8
15+
uses: actions/setup-java@v1.4.3
16+
with:
17+
java-version: 1.8
18+
19+
- name: Cache Gradle dependencies
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.gradle/caches
23+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
24+
restore-keys: ${{ runner.os }}-gradle
25+
26+
- name: Build JavaDocs
27+
run: ./gradlew aggregatedJavadocs
28+
29+
- name: Deploy JavaDocs
30+
uses: peaceiris/actions-gh-pages@v3
31+
with:
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
publish_dir: ./build/docs

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NewPipe Extractor
22

3-
[![Build Status](https://travis-ci.org/TeamNewPipe/NewPipeExtractor.svg?branch=master)](https://travis-ci.org/TeamNewPipe/NewPipeExtractor) [![JIT Pack Badge](https://jitpack.io/v/TeamNewPipe/NewPipeExtractor.svg)](https://jitpack.io/#TeamNewPipe/NewPipeExtractor) [JDoc](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/)[Documentation](https://teamnewpipe.github.io/documentation/)
3+
[![Build Status](https://github.com/TeamNewPipe/NewPipeExtractor/workflows/CI/badge.svg?branch=dev&event=push)](https://github.com/TeamNewPipe/NewPipeExtractor/actions) [![JIT Pack Badge](https://jitpack.io/v/TeamNewPipe/NewPipeExtractor.svg)](https://jitpack.io/#TeamNewPipe/NewPipeExtractor) [JDoc](https://teamnewpipe.github.io/NewPipeExtractor/javadoc/)[Documentation](https://teamnewpipe.github.io/documentation/)
44

55
NewPipe Extractor is a library for extracting things from streaming sites. It is a core component of [NewPipe](https://github.com/TeamNewPipe/NewPipe), but could be used independently.
66

@@ -11,7 +11,7 @@ NewPipe Extractor is available at JitPack's Maven repo.
1111
If you're using Gradle, you could add NewPipe Extractor as a dependency with the following steps:
1212

1313
1. Add `maven { url 'https://jitpack.io' }` to the `repositories` in your `build.gradle`.
14-
2. Add `implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.20.6'`the `dependencies` in your `build.gradle`. Replace `v0.20.6` with the latest release.
14+
2. Add `implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.20.8'`the `dependencies` in your `build.gradle`. Replace `v0.20.8` with the latest release.
1515

1616
**Note:** To use NewPipe Extractor in projects with a `minSdkVersion` below 26, [API desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) is required.
1717

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ allprojects {
55
sourceCompatibility = 1.8
66
targetCompatibility = 1.8
77

8-
version 'v0.20.5'
8+
version 'v0.20.8'
99
group 'com.github.TeamNewPipe'
1010

1111
repositories {
@@ -43,7 +43,7 @@ task aggregatedJavadocs(type: Javadoc, group: 'Documentation') {
4343
destinationDir = file("$buildDir/docs/javadoc")
4444
title = "$project.name $version"
4545
// options.memberLevel = JavadocMemberLevel.PRIVATE
46-
options.links 'https://docs.oracle.com/javase/7/docs/api/'
46+
options.links 'https://docs.oracle.com/javase/8/docs/api/'
4747
options.encoding 'UTF-8'
4848

4949
subprojects.each { project ->

extractor/build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
test {
2+
// Pass on downloader type to tests for different CI jobs. See DownloaderFactory.java and ci.yml
3+
if (System.properties.containsKey('downloader')) {
4+
systemProperty('downloader', System.getProperty('downloader'))
5+
}
6+
}
7+
18
dependencies {
29
implementation project(':timeago-parser')
310

@@ -7,6 +14,7 @@ dependencies {
714
implementation 'com.github.spotbugs:spotbugs-annotations:4.0.2'
815
implementation 'org.nibor.autolink:autolink:0.10.0'
916

10-
testImplementation 'junit:junit:4.13'
17+
testImplementation 'junit:junit:4.13.1'
1118
testImplementation "com.squareup.okhttp3:okhttp:3.12.11"
19+
testImplementation 'com.google.code.gson:gson:2.8.6'
1220
}

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
import org.schabi.newpipe.extractor.exceptions.FoundAdException;
44
import org.schabi.newpipe.extractor.exceptions.ParsingException;
55

6+
import javax.annotation.Nullable;
67
import java.util.ArrayList;
78
import java.util.Collections;
9+
import java.util.Comparator;
810
import java.util.List;
911

1012
/*
@@ -32,17 +34,31 @@ public abstract class InfoItemsCollector<I extends InfoItem, E extends InfoItemE
3234
private final List<I> itemList = new ArrayList<>();
3335
private final List<Throwable> errors = new ArrayList<>();
3436
private final int serviceId;
37+
@Nullable
38+
private final Comparator<I> comparator;
39+
40+
/**
41+
* Create a new collector with no comparator / sorting function
42+
* @param serviceId the service id
43+
*/
44+
public InfoItemsCollector(final int serviceId) {
45+
this(serviceId, null);
46+
}
3547

3648
/**
3749
* Create a new collector
3850
* @param serviceId the service id
3951
*/
40-
public InfoItemsCollector(int serviceId) {
52+
public InfoItemsCollector(final int serviceId, @Nullable final Comparator<I> comparator) {
4153
this.serviceId = serviceId;
54+
this.comparator = comparator;
4255
}
4356

4457
@Override
4558
public List<I> getItems() {
59+
if (comparator != null) {
60+
itemList.sort(comparator);
61+
}
4662
return Collections.unmodifiableList(itemList);
4763
}
4864

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package org.schabi.newpipe.extractor;
2+
3+
import org.schabi.newpipe.extractor.stream.Description;
4+
5+
import java.io.Serializable;
6+
import java.net.URL;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
10+
import javax.annotation.Nonnull;
11+
12+
public class MetaInfo implements Serializable {
13+
14+
private String title = "";
15+
private Description content;
16+
private List<URL> urls = new ArrayList<>();
17+
private List<String> urlTexts = new ArrayList<>();
18+
19+
public MetaInfo(@Nonnull final String title, @Nonnull final Description content,
20+
@Nonnull final List<URL> urls, @Nonnull final List<String> urlTexts) {
21+
this.title = title;
22+
this.content = content;
23+
this.urls = urls;
24+
this.urlTexts = urlTexts;
25+
}
26+
27+
public MetaInfo() {
28+
}
29+
30+
/**
31+
* @return Title of the info. Can be empty.
32+
*/
33+
@Nonnull
34+
public String getTitle() {
35+
return title;
36+
}
37+
38+
public void setTitle(@Nonnull final String title) {
39+
this.title = title;
40+
}
41+
42+
@Nonnull
43+
public Description getContent() {
44+
return content;
45+
}
46+
47+
public void setContent(@Nonnull final Description content) {
48+
this.content = content;
49+
}
50+
51+
@Nonnull
52+
public List<URL> getUrls() {
53+
return urls;
54+
}
55+
56+
public void setUrls(@Nonnull final List<URL> urls) {
57+
this.urls = urls;
58+
}
59+
60+
public void addUrl(@Nonnull final URL url) {
61+
urls.add(url);
62+
}
63+
64+
@Nonnull
65+
public List<String> getUrlTexts() {
66+
return urlTexts;
67+
}
68+
69+
public void setUrlTexts(@Nonnull final List<String> urlTexts) {
70+
this.urlTexts = urlTexts;
71+
}
72+
73+
public void addUrlText(@Nonnull final String urlText) {
74+
urlTexts.add(urlText);
75+
}
76+
}

extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItem.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class CommentsInfoItem extends InfoItem {
1616
@Nullable
1717
private DateWrapper uploadDate;
1818
private int likeCount;
19+
private boolean heartedByUploader;
1920

2021
public CommentsInfoItem(int serviceId, String url, String name) {
2122
super(InfoType.COMMENT, serviceId, url, name);
@@ -85,4 +86,12 @@ public int getLikeCount() {
8586
public void setLikeCount(int likeCount) {
8687
this.likeCount = likeCount;
8788
}
89+
90+
public void setHeartedByUploader(boolean isHeartedByUploader) {
91+
this.heartedByUploader = isHeartedByUploader;
92+
}
93+
94+
public boolean getHeartedByUploader() {
95+
return this.heartedByUploader;
96+
}
8897
}

extractor/src/main/java/org/schabi/newpipe/extractor/comments/CommentsInfoItemExtractor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,9 @@ public interface CommentsInfoItemExtractor extends InfoItemExtractor {
4040
String getUploaderName() throws ParsingException;
4141

4242
String getUploaderAvatarUrl() throws ParsingException;
43+
44+
/**
45+
* Whether the comment has been hearted by the uploader
46+
*/
47+
boolean getHeartedByUploader() throws ParsingException;
4348
}

0 commit comments

Comments
 (0)