[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
|
||||
*/
|
||||
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")
|
||||
+ "&client_id=" + clientId();
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ import javax.annotation.Nonnull;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -55,14 +57,14 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
|
|||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTextualUploadDate() {
|
||||
return track.getString("created_at");
|
||||
public String getTextualUploadDate() throws ParsingException {
|
||||
return track.getString("created_at").replace("T"," ").replace("Z", "");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public DateWrapper getUploadDate() throws ParsingException {
|
||||
return new DateWrapper(SoundcloudParsingHelper.parseDate(getTextualUploadDate()));
|
||||
return new DateWrapper(SoundcloudParsingHelper.parseDate(track.getString("created_at")));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SoundcloudStreamExtractorDefaultTest {
|
|||
|
||||
@Test
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue