2
0
mirror of https://github.com/TeamNewPipe/NewPipeExtractor synced 2025-08-30 13:57:46 +00:00

[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

View File

@@ -43,13 +43,15 @@ public class SoundcloudParsingHelper {
private SoundcloudParsingHelper() { private SoundcloudParsingHelper() {
} }
public static String clientId() throws ExtractionException, IOException { public synchronized static String clientId() throws ExtractionException, IOException {
if (!isNullOrEmpty(clientId)) return clientId; if (!isNullOrEmpty(clientId)) return clientId;
Downloader dl = NewPipe.getDownloader(); Downloader dl = NewPipe.getDownloader();
clientId = HARDCODED_CLIENT_ID; clientId = HARDCODED_CLIENT_ID;
if (checkIfHardcodedClientIdIsValid()) { if (checkIfHardcodedClientIdIsValid()) {
return clientId; return clientId;
} else {
clientId = null;
} }
final Response download = dl.get("https://soundcloud.com"); final Response download = dl.get("https://soundcloud.com");