Skip to content

Commit 345494f

Browse files
[SoundCloud] Add some logging to SoundcloudParsingHelper.java
1 parent c7782fe commit 345494f

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
@@ -27,6 +27,7 @@
2727
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudPlaylistInfoItemExtractor;
2828
import org.schabi.newpipe.extractor.services.soundcloud.extractors.SoundcloudStreamInfoItemExtractor;
2929
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
30+
import org.schabi.newpipe.extractor.utils.ExtractorLogger;
3031
import org.schabi.newpipe.extractor.utils.ImageSuffix;
3132
import org.schabi.newpipe.extractor.utils.JsonUtils;
3233
import org.schabi.newpipe.extractor.utils.Parser;
@@ -85,6 +86,7 @@ public final class SoundcloudParsingHelper {
8586
private static final List<ImageSuffix> VISUALS_IMAGE_SUFFIXES =
8687
List.of(new ImageSuffix("t1240x260", 1240, 260, MEDIUM),
8788
new ImageSuffix("t2480x520", 2480, 520, MEDIUM));
89+
public static final String TAG = SoundcloudParsingHelper.class.getSimpleName();
8890

8991
private static String clientId;
9092
public static final String SOUNDCLOUD_API_V2_URL = "https://api-v2.soundcloud.com/";
@@ -98,6 +100,7 @@ private SoundcloudParsingHelper() {
98100

99101
public static synchronized String clientId() throws ExtractionException, IOException {
100102
if (!isNullOrEmpty(clientId)) {
103+
ExtractorLogger.d(TAG, "Returning clientId=" + clientId);
101104
return clientId;
102105
}
103106

@@ -119,9 +122,11 @@ public static synchronized String clientId() throws ExtractionException, IOExcep
119122
final String srcUrl = element.attr("src");
120123
if (!isNullOrEmpty(srcUrl)) {
121124
try {
125+
ExtractorLogger.d(TAG, "Searching for clientId in " + srcUrl);
122126
clientId = Parser.matchGroup1(clientIdPattern, dl.get(srcUrl, headers)
123127
.validateResponseCode()
124128
.responseBody());
129+
ExtractorLogger.d(TAG, "Found clientId=" + clientId);
125130
return clientId;
126131
} catch (final RegexException ignored) {
127132
// Ignore it and proceed to try searching other script
@@ -157,6 +162,7 @@ public static OffsetDateTime parseDateFrom(final String textualUploadDate)
157162
// CHECKSTYLE:ON
158163
public static JsonObject resolveFor(@Nonnull final Downloader downloader, final String url)
159164
throws IOException, ExtractionException {
165+
ExtractorLogger.d(TAG, "resolveFor(" + url + ")");
160166
final String apiUrl = SOUNDCLOUD_API_V2_URL + "resolve"
161167
+ "?url=" + Utils.encodeUrlUtf8(url)
162168
+ "&client_id=" + clientId();

0 commit comments

Comments
 (0)