|
16 | 16 | import org.schabi.newpipe.extractor.NewPipe; |
17 | 17 | import org.schabi.newpipe.extractor.StreamingService; |
18 | 18 | import org.schabi.newpipe.extractor.downloader.Downloader; |
19 | | -import org.schabi.newpipe.extractor.exceptions.AgeRestrictedContentException; |
20 | | -import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException; |
21 | | -import org.schabi.newpipe.extractor.exceptions.ExtractionException; |
22 | | -import org.schabi.newpipe.extractor.exceptions.GeographicRestrictionException; |
23 | | -import org.schabi.newpipe.extractor.exceptions.PaidContentException; |
24 | | -import org.schabi.newpipe.extractor.exceptions.ParsingException; |
25 | | -import org.schabi.newpipe.extractor.exceptions.PrivateContentException; |
26 | | -import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; |
27 | | -import org.schabi.newpipe.extractor.exceptions.YoutubeMusicPremiumContentException; |
| 19 | +import org.schabi.newpipe.extractor.downloader.Response; |
| 20 | +import org.schabi.newpipe.extractor.exceptions.*; |
28 | 21 | import org.schabi.newpipe.extractor.linkhandler.LinkHandler; |
29 | 22 | import org.schabi.newpipe.extractor.localization.DateWrapper; |
30 | 23 | import org.schabi.newpipe.extractor.localization.Localization; |
@@ -792,11 +785,9 @@ public void onFetchPage(@Nonnull final Downloader downloader) |
792 | 785 | } |
793 | 786 |
|
794 | 787 | private void fetchVideoInfoPage() throws ParsingException, ReCaptchaException, IOException { |
795 | | - final String sts = getEmbeddedInfoStsAndStorePlayerJsUrl(); |
796 | | - final String videoInfoUrl = getVideoInfoUrl(getId(), sts); |
797 | | - final String infoPageResponse = NewPipe.getDownloader() |
798 | | - .get(videoInfoUrl, getExtractorLocalization()).responseBody(); |
799 | | - videoInfoPage.putAll(Parser.compatParseMap(infoPageResponse)); |
| 788 | + final String videoInfoUrl = getVideoInfoUrl(getId()); |
| 789 | + final Response videoInfoResponse = NewPipe.getDownloader().get(videoInfoUrl, getExtractorLocalization()); |
| 790 | + videoInfoPage.putAll(Parser.compatParseMap(videoInfoResponse.responseBody())); |
800 | 791 |
|
801 | 792 | try { |
802 | 793 | playerResponse = JsonParser.object().from(videoInfoPage.get("player_response")); |
@@ -975,11 +966,11 @@ private JsonObject getVideoSecondaryInfoRenderer() throws ParsingException { |
975 | 966 | } |
976 | 967 |
|
977 | 968 | @Nonnull |
978 | | - private static String getVideoInfoUrl(final String id, final String sts) { |
| 969 | + private static String getVideoInfoUrl(final String id) { |
979 | 970 | // TODO: Try parsing embedded_player_response first |
980 | 971 | return "https://www.youtube.com/get_video_info?" + "video_id=" + id + |
981 | | - "&html5=1&eurl=https://youtube.googleapis.com/v/" + id + |
982 | | - "&sts=" + sts + "&ps=default&gl=US&hl=en"; |
| 972 | + "&eurl=https://youtube.googleapis.com/v/" + id + |
| 973 | + "&html5=1&c=TVHTML5&cver=6.20180913&gl=US&hl=en"; |
983 | 974 | } |
984 | 975 |
|
985 | 976 | private Map<String, ItagItem> getItags(final String streamingDataKey, |
@@ -1121,7 +1112,7 @@ public Privacy getPrivacy() { |
1121 | 1112 | public String getCategory() { |
1122 | 1113 | return playerResponse.getObject("microformat") |
1123 | 1114 | .getObject("playerMicroformatRenderer") |
1124 | | - .getString("category"); |
| 1115 | + .getString("category", EMPTY_STRING); |
1125 | 1116 | } |
1126 | 1117 |
|
1127 | 1118 | @Nonnull |
|
0 commit comments