Merge 021e6c4b41
into 731102be39
This commit is contained in:
commit
e54bcf1064
|
@ -22,16 +22,20 @@ public class SoundcloudParsingHelper {
|
||||||
private SoundcloudParsingHelper() {
|
private SoundcloudParsingHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String clientId() throws ReCaptchaException, IOException, RegexException {
|
private static String clientId;
|
||||||
Downloader dl = NewPipe.getDownloader();
|
|
||||||
|
|
||||||
String response = dl.download("https://soundcloud.com");
|
public static String clientId() throws ReCaptchaException, IOException, RegexException {
|
||||||
Document doc = Jsoup.parse(response);
|
if (clientId.isEmpty()) {
|
||||||
|
Downloader dl = NewPipe.getDownloader();
|
||||||
|
|
||||||
Element jsElement = doc.select("script[src^=https://a-v2.sndcdn.com/assets/app]").first();
|
String response = dl.download("https://soundcloud.com");
|
||||||
String js = dl.download(jsElement.attr("src"));
|
Document doc = Jsoup.parse(response);
|
||||||
|
|
||||||
String clientId = Parser.matchGroup1(",client_id:\"(.*?)\"", js);
|
Element jsElement = doc.select("script[src^=https://a-v2.sndcdn.com/assets/app]").first();
|
||||||
|
String js = dl.download(jsElement.attr("src"));
|
||||||
|
|
||||||
|
clientId = Parser.matchGroup1(",client_id:\"(.*?)\"", js);
|
||||||
|
}
|
||||||
return clientId;
|
return clientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,5 +80,4 @@ public class SoundcloudParsingHelper {
|
||||||
throw new ParsingException(e.getMessage(), e);
|
throw new ParsingException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue