[SoundCloud] Fix concurrency issue when getting the client id

This commit is contained in:
Mauricio Colli 2020-06-24 01:45:19 -03:00
parent 92f6754f0f
commit d2f1c0f40d
No known key found for this signature in database
GPG Key ID: F200BFD6F29DDD85
1 changed files with 3 additions and 1 deletions

View File

@ -43,13 +43,15 @@ public class SoundcloudParsingHelper {
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");