Skip to content

Commit

Permalink
Merge pull request #359 from mauriciocolli/fix-client-id-bug
Browse files Browse the repository at this point in the history
[SoundCloud] Fix concurrency issue when getting the client id
  • Loading branch information
TobiGr authored Jun 27, 2020
2 parents dbf6ab9 + 7505e82 commit 970bc7f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@
import static org.schabi.newpipe.extractor.utils.Utils.replaceHttpWithHttps;

public class SoundcloudParsingHelper {
private static final String HARDCODED_CLIENT_ID = "Uz4aPhG7GAl1VYGOnvOPW1wQ0M6xKtA9"; // Updated on 16/03/20
private static final String HARDCODED_CLIENT_ID = "H2c34Q0E7hftqnuDHGsk88DbNqhYpgMm"; // Updated on 24/06/20
private static String clientId;

private SoundcloudParsingHelper() {
}

public static String clientId() throws ExtractionException, IOException {
public synchronized static String clientId() throws ExtractionException, IOException {
if (!isNullOrEmpty(clientId)) return clientId;

Downloader dl = NewPipe.getDownloader();
clientId = HARDCODED_CLIENT_ID;
if (checkIfHardcodedClientIdIsValid()) {
return clientId;
} else {
clientId = null;
}

final Response download = dl.get("https://soundcloud.com");
Expand Down

0 comments on commit 970bc7f

Please sign in to comment.