2828import org .schabi .newpipe .extractor .services .soundcloud .extractors .SoundcloudLikesInfoItemExtractor ;
2929import org .schabi .newpipe .extractor .services .soundcloud .extractors .SoundcloudStreamInfoItemExtractor ;
3030import org .schabi .newpipe .extractor .stream .StreamInfoItemsCollector ;
31+ import org .schabi .newpipe .extractor .utils .ExtractorLogger ;
3132import org .schabi .newpipe .extractor .utils .ImageSuffix ;
3233import org .schabi .newpipe .extractor .utils .JsonUtils ;
3334import org .schabi .newpipe .extractor .utils .Parser ;
@@ -86,6 +87,7 @@ public final class SoundcloudParsingHelper {
8687 private static final List <ImageSuffix > VISUALS_IMAGE_SUFFIXES =
8788 List .of (new ImageSuffix ("t1240x260" , 1240 , 260 , MEDIUM ),
8889 new ImageSuffix ("t2480x520" , 2480 , 520 , MEDIUM ));
90+ public static final String TAG = SoundcloudParsingHelper .class .getSimpleName ();
8991
9092 private static String clientId ;
9193 public static final String SOUNDCLOUD_API_V2_URL = "https://api-v2.soundcloud.com/" ;
@@ -99,6 +101,7 @@ private SoundcloudParsingHelper() {
99101
100102 public static synchronized String clientId () throws ExtractionException , IOException {
101103 if (!isNullOrEmpty (clientId )) {
104+ ExtractorLogger .d (TAG , "Returning clientId=" + clientId );
102105 return clientId ;
103106 }
104107
@@ -120,9 +123,11 @@ public static synchronized String clientId() throws ExtractionException, IOExcep
120123 final String srcUrl = element .attr ("src" );
121124 if (!isNullOrEmpty (srcUrl )) {
122125 try {
126+ ExtractorLogger .d (TAG , "Searching for clientId in " + srcUrl );
123127 clientId = Parser .matchGroup1 (clientIdPattern , dl .get (srcUrl , headers )
124128 .validateResponseCode ()
125129 .responseBody ());
130+ ExtractorLogger .d (TAG , "Found clientId=" + clientId );
126131 return clientId ;
127132 } catch (final RegexException ignored ) {
128133 // Ignore it and proceed to try searching other script
@@ -158,6 +163,7 @@ public static OffsetDateTime parseDateFrom(final String textualUploadDate)
158163 // CHECKSTYLE:ON
159164 public static JsonObject resolveFor (@ Nonnull final Downloader downloader , final String url )
160165 throws IOException , ExtractionException {
166+ ExtractorLogger .d (TAG , "resolveFor(" + url + ")" );
161167 final String apiUrl = SOUNDCLOUD_API_V2_URL + "resolve"
162168 + "?url=" + Utils .encodeUrlUtf8 (url )
163169 + "&client_id=" + clientId ();
0 commit comments