|
14 | 14 | import org.schabi.newpipe.extractor.exceptions.ParsingException; |
15 | 15 | import org.schabi.newpipe.extractor.linkhandler.LinkHandler; |
16 | 16 | import org.schabi.newpipe.extractor.localization.DateWrapper; |
17 | | -import org.schabi.newpipe.extractor.stream.*; |
| 17 | +import org.schabi.newpipe.extractor.stream.AudioStream; |
| 18 | +import org.schabi.newpipe.extractor.stream.Description; |
| 19 | +import org.schabi.newpipe.extractor.stream.StreamExtractor; |
| 20 | +import org.schabi.newpipe.extractor.stream.StreamInfoItem; |
| 21 | +import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector; |
| 22 | +import org.schabi.newpipe.extractor.stream.StreamType; |
| 23 | +import org.schabi.newpipe.extractor.stream.SubtitlesStream; |
| 24 | +import org.schabi.newpipe.extractor.stream.VideoStream; |
18 | 25 |
|
19 | 26 | import java.io.IOException; |
20 | 27 | import java.io.UnsupportedEncodingException; |
@@ -148,24 +155,13 @@ public List<AudioStream> getAudioStreams() throws IOException, ExtractionExcepti |
148 | 155 | List<AudioStream> audioStreams = new ArrayList<>(); |
149 | 156 | Downloader dl = NewPipe.getDownloader(); |
150 | 157 |
|
151 | | - String apiUrl = "https://api-v2.soundcloud.com/tracks/" + urlEncode(getId()) |
152 | | - + "?client_id=" + urlEncode(SoundcloudParsingHelper.clientId()); |
153 | | - |
154 | | - String response = dl.get(apiUrl, getExtractorLocalization()).responseBody(); |
155 | | - JsonObject responseObject; |
156 | | - try { |
157 | | - responseObject = JsonParser.object().from(response); |
158 | | - } catch (JsonParserException e) { |
159 | | - throw new ParsingException("Could not parse json response", e); |
160 | | - } |
161 | | - |
162 | 158 | // Streams can be streamable and downloadable - or explicitly not. |
163 | 159 | // For playing the track, it is only necessary to have a streamable track. |
164 | 160 | // If this is not the case, this track might not be published yet. |
165 | | - if (!responseObject.getBoolean("streamable")) return audioStreams; |
| 161 | + if (!track.getBoolean("streamable")) return audioStreams; |
166 | 162 |
|
167 | 163 | try { |
168 | | - JsonArray transcodings = responseObject.getObject("media").getArray("transcodings"); |
| 164 | + JsonArray transcodings = track.getObject("media").getArray("transcodings"); |
169 | 165 |
|
170 | 166 | // get information about what stream formats are available |
171 | 167 | for (Object transcoding : transcodings) { |
|
0 commit comments