Skip to content

Commit 7632a66

Browse files
[SoundCloud] Add some logging to SoundcloudParsingHelper.java
1 parent d05f89c commit 7632a66

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
@@ -29,6 +29,7 @@
2929
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudLikesInfoItemExtractor;
3030
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudStreamInfoItemExtractor;
3131
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
32+
import org.schabi.newpipe.extractor.utils.ExtractorLogger;
3233
import org.schabi.newpipe.extractor.utils.ImageSuffix;
3334
import org.schabi.newpipe.extractor.utils.JsonUtils;
3435
import org.schabi.newpipe.extractor.utils.Parser;
@@ -87,6 +88,7 @@ public final class SoundcloudParsingHelper {
8788
private static final List<ImageSuffix> VISUALS_IMAGE_SUFFIXES =
8889
List.of(new ImageSuffix("t1240x260", 1240, 260, MEDIUM),
8990
new ImageSuffix("t2480x520", 2480, 520, MEDIUM));
91+
public static final String TAG = SoundcloudParsingHelper.class.getSimpleName();
9092

9193
private static String clientId;
9294
public static final String SOUNDCLOUD_API_V2_URL = "https://api-v2.soundcloud.com/";
@@ -100,6 +102,7 @@ private SoundcloudParsingHelper() {
100102

101103
public static synchronized String clientId() throws ExtractionException, IOException {
102104
if (!isNullOrEmpty(clientId)) {
105+
ExtractorLogger.d(TAG, "Returning clientId=" + clientId);
103106
return clientId;
104107
}
105108

@@ -121,9 +124,11 @@ public static synchronized String clientId() throws ExtractionException, IOExcep
121124
final String srcUrl = element.attr("src");
122125
if (!isNullOrEmpty(srcUrl)) {
123126
try {
127+
ExtractorLogger.d(TAG, "Searching for clientId in " + srcUrl);
124128
clientId = Parser.matchGroup1(clientIdPattern, dl.get(srcUrl, headers)
125129
.validateResponseCode()
126130
.responseBody());
131+
ExtractorLogger.d(TAG, "Found clientId=" + clientId);
127132
return clientId;
128133
} catch (final RegexException ignored) {
129134
// Ignore it and proceed to try searching other script
@@ -159,6 +164,7 @@ public static DateWrapper parseDate(final String uploadDate) throws ParsingExcep
159164
// CHECKSTYLE:ON
160165
public static JsonObject resolveFor(@Nonnull final Downloader downloader, final String url)
161166
throws IOException, ExtractionException {
167+
ExtractorLogger.d(TAG, "resolveFor(" + url + ")");
162168
final String apiUrl = SOUNDCLOUD_API_V2_URL + "resolve"
163169
+ "?url=" + Utils.encodeUrlUtf8(url)
164170
+ "&client_id=" + clientId();

0 commit comments

Comments
 (0)