11package org .schabi .newpipe .extractor .services .soundcloud ;
22
3+ import static org .schabi .newpipe .extractor .ServiceList .SoundCloud ;
4+ import static org .schabi .newpipe .extractor .utils .Utils .EMPTY_STRING ;
5+ import static org .schabi .newpipe .extractor .utils .Utils .UTF_8 ;
6+ import static org .schabi .newpipe .extractor .utils .Utils .isNullOrEmpty ;
7+ import static org .schabi .newpipe .extractor .utils .Utils .replaceHttpWithHttps ;
8+ import static java .util .Collections .singletonList ;
9+
310import com .grack .nanojson .JsonArray ;
411import com .grack .nanojson .JsonObject ;
512import com .grack .nanojson .JsonParser ;
613import com .grack .nanojson .JsonParserException ;
14+
715import org .jsoup .Jsoup ;
816import org .jsoup .nodes .Document ;
917import org .jsoup .nodes .Element ;
2331import org .schabi .newpipe .extractor .utils .Parser .RegexException ;
2432import org .schabi .newpipe .extractor .utils .Utils ;
2533
26- import javax .annotation .Nonnull ;
2734import java .io .IOException ;
2835import java .net .MalformedURLException ;
2936import java .net .URL ;
3542import java .util .HashMap ;
3643import java .util .List ;
3744
38- import static java .util .Collections .singletonList ;
39- import static org .schabi .newpipe .extractor .ServiceList .SoundCloud ;
40- import static org .schabi .newpipe .extractor .utils .Utils .*;
45+ import javax .annotation .Nonnull ;
4146
4247public class SoundcloudParsingHelper {
43- static final String HARDCODED_CLIENT_ID =
44- "0vyDB4rxVEprGutWT0xQ2VZhYpVZxku4" ; // Updated on 2022-02-11
4548 private static String clientId ;
4649 public static final String SOUNDCLOUD_API_V2_URL = "https://api-v2.soundcloud.com/" ;
4750
@@ -52,12 +55,6 @@ public static synchronized String clientId() throws ExtractionException, IOExcep
5255 if (!isNullOrEmpty (clientId )) return clientId ;
5356
5457 final Downloader dl = NewPipe .getDownloader ();
55- clientId = HARDCODED_CLIENT_ID ;
56- if (checkIfHardcodedClientIdIsValid ()) {
57- return clientId ;
58- } else {
59- clientId = null ;
60- }
6158
6259 final Response download = dl .get ("https://soundcloud.com" );
6360 final String responseBody = download .responseBody ();
@@ -89,14 +86,6 @@ public static synchronized String clientId() throws ExtractionException, IOExcep
8986 throw new ExtractionException ("Couldn't extract client id" );
9087 }
9188
92- static boolean checkIfHardcodedClientIdIsValid () throws IOException , ReCaptchaException {
93- final int responseCode = NewPipe .getDownloader ().get (SOUNDCLOUD_API_V2_URL + "?client_id="
94- + HARDCODED_CLIENT_ID ).responseCode ();
95- // If the response code is 404, it means that the client_id is valid; otherwise,
96- // it should be not valid
97- return responseCode == 404 ;
98- }
99-
10089 public static OffsetDateTime parseDateFrom (final String textualUploadDate )
10190 throws ParsingException {
10291 try {
0 commit comments