mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-14 22:30:33 +05:30
[SoundCloud] Migrate StreamExtractor to api-v2
This commit is contained in:
parent
5e4ddb368f
commit
4389fd3b7b
@ -108,7 +108,7 @@ public class SoundcloudParsingHelper {
|
|||||||
* See https://developers.soundcloud.com/docs/api/reference#resolve
|
* See https://developers.soundcloud.com/docs/api/reference#resolve
|
||||||
*/
|
*/
|
||||||
public static JsonObject resolveFor(Downloader downloader, String url) throws IOException, ExtractionException {
|
public static JsonObject resolveFor(Downloader downloader, String url) throws IOException, ExtractionException {
|
||||||
String apiUrl = "https://api.soundcloud.com/resolve"
|
String apiUrl = "https://api-v2.soundcloud.com/resolve"
|
||||||
+ "?url=" + URLEncoder.encode(url, "UTF-8")
|
+ "?url=" + URLEncoder.encode(url, "UTF-8")
|
||||||
+ "&client_id=" + clientId();
|
+ "&client_id=" + clientId();
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ import javax.annotation.Nonnull;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -55,14 +57,14 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getTextualUploadDate() {
|
public String getTextualUploadDate() throws ParsingException {
|
||||||
return track.getString("created_at");
|
return track.getString("created_at").replace("T"," ").replace("Z", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public DateWrapper getUploadDate() throws ParsingException {
|
public DateWrapper getUploadDate() throws ParsingException {
|
||||||
return new DateWrapper(SoundcloudParsingHelper.parseDate(getTextualUploadDate()));
|
return new DateWrapper(SoundcloudParsingHelper.parseDate(track.getString("created_at")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -74,7 +74,7 @@ public class SoundcloudStreamExtractorDefaultTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetTextualUploadDate() throws ParsingException {
|
public void testGetTextualUploadDate() throws ParsingException {
|
||||||
Assert.assertEquals("2016/07/31 18:18:07 +0000", extractor.getTextualUploadDate());
|
Assert.assertEquals("2016-07-31 18:18:07", extractor.getTextualUploadDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user