Skip to content

Commit 1188011

Browse files
absurdlylongusernameStypox
authored andcommitted
[SoundCloud] Add some logging to SoundcloudParsingHelper.java
1 parent 1d553dc commit 1188011

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudLikesInfoItemExtractor;
2929
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudStreamInfoItemExtractor;
3030
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
31+
import org.schabi.newpipe.extractor.utils.ExtractorLogger;
3132
import org.schabi.newpipe.extractor.utils.ImageSuffix;
3233
import org.schabi.newpipe.extractor.utils.JsonUtils;
3334
import 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

Comments
 (0)