Skip to content

Commit 8cb3250

Browse files
authored
Merge pull request #217 from TeamNewPipe/fix/SC_client_id
Fix SoundCloud client_id extraction and update SoundCloud client_id
2 parents be79f20 + 54d1a1a commit 8cb3250

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps;
3232

3333
public class SoundcloudParsingHelper {
34-
private static final String HARDCODED_CLIENT_ID = "LHzSAKe8eP9Yy3FgBugfBapRPLncO6Ng"; // Updated on 22/10/19
34+
private static final String HARDCODED_CLIENT_ID = "bkcJLoXNaiFlsLaKBQXOxO5FhW0NJVnu"; // Updated on 29/11/19
3535
private static String clientId;
3636

3737
private SoundcloudParsingHelper() {
@@ -73,10 +73,15 @@ public static String clientId() throws ExtractionException, IOException {
7373
throw new ExtractionException("Couldn't extract client id");
7474
}
7575

76-
static boolean checkIfHardcodedClientIdIsValid(Downloader dl) throws IOException, ReCaptchaException {
76+
static boolean checkIfHardcodedClientIdIsValid(Downloader dl) {
7777
final String apiUrl = "https://api.soundcloud.com/connect?client_id=" + HARDCODED_CLIENT_ID;
78-
// Should return 200 to indicate that the client id is valid, a 401 is returned otherwise.
79-
return dl.head(apiUrl).responseCode() == 200;
78+
try {
79+
// Should return 200 to indicate that the client id is valid, a 401 is returned otherwise.
80+
return dl.head(apiUrl).responseCode() == 200;
81+
} catch (Exception ignored) {
82+
// No need to throw an exception here. If something went wrong, the client_id is wrong
83+
return false;
84+
}
8085
}
8186

8287
static Calendar parseDate(String textualUploadDate) throws ParsingException {

0 commit comments

Comments
 (0)