-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #610 from TeamNewPipe/bandcamp_related_items
Extract related bandcamp items
- Loading branch information
Showing
4 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...pipe/extractor/services/bandcamp/extractors/BandcampRelatedPlaylistInfoItemExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Created by Fynn Godau 2021, licensed GNU GPL version 3 or later | ||
|
||
package org.schabi.newpipe.extractor.services.bandcamp.extractors; | ||
|
||
import org.jsoup.nodes.Element; | ||
import org.schabi.newpipe.extractor.exceptions.ParsingException; | ||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemExtractor; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
/** | ||
* Extracts recommended albums from tracks' website | ||
*/ | ||
public class BandcampRelatedPlaylistInfoItemExtractor implements PlaylistInfoItemExtractor { | ||
private final Element relatedAlbum; | ||
|
||
public BandcampRelatedPlaylistInfoItemExtractor(@Nonnull Element relatedAlbum) { | ||
this.relatedAlbum = relatedAlbum; | ||
} | ||
|
||
@Override | ||
public String getName() throws ParsingException { | ||
return relatedAlbum.getElementsByClass("release-title").text(); | ||
} | ||
|
||
@Override | ||
public String getUrl() throws ParsingException { | ||
return relatedAlbum.getElementsByClass("title-and-artist").attr("abs:href"); | ||
} | ||
|
||
@Override | ||
public String getThumbnailUrl() throws ParsingException { | ||
return relatedAlbum.getElementsByClass("album-art").attr("src"); | ||
} | ||
|
||
@Override | ||
public String getUploaderName() throws ParsingException { | ||
return relatedAlbum.getElementsByClass("by-artist").text().replace("by ", ""); | ||
} | ||
|
||
@Override | ||
public long getStreamCount() throws ParsingException { | ||
return -1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters