MD5 校验值:61e58c10a11e4adec8760ee3854e996a
BandcampCommentsExtractor.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package org.schabi.newpipe.extractor.services.bandcamp.extractors; import S5.h; import S5.l; import S5.p; import U5.o; import U5.q; import Z5.a; import a4.C0230a; import a4.c; import a4.e; import f6.b; import j3.AbstractC1888a; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import org.schabi.newpipe.extractor.ListExtractor; import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.comments.CommentsExtractor; import org.schabi.newpipe.extractor.comments.CommentsInfoItem; import org.schabi.newpipe.extractor.comments.CommentsInfoItemExtractor; import org.schabi.newpipe.extractor.comments.CommentsInfoItemsCollector; import org.schabi.newpipe.extractor.downloader.Downloader; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException; import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; import org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper; import org.schabi.newpipe.extractor.utils.JsonUtils; import v0.AbstractC2363a; public class BandcampCommentsExtractor extends CommentsExtractor { private static final String REVIEWS_API_URL = "https://bandcamp.com/api/tralbumcollectors/2/reviews"; private h document; public BandcampCommentsExtractor(StreamingService streamingService, ListLinkHandler listLinkHandler) { super(streamingService, listLinkHandler); } private c fetchReviewsData(String str, String str2) { try { Downloader downloader = getDownloader(); Map<String, List<String>> emptyMap = Collections.emptyMap(); e eVar = new e(); eVar.i(); eVar.r("tralbum_type", "t"); eVar.r("tralbum_id", str); eVar.r("token", str2); eVar.m(PeertubeParsingHelper.COUNT_KEY); eVar.o(Integer.toString(7)); eVar.c("exclude_fan_ids"); eVar.f(); eVar.f(); return JsonUtils.toJsonObject(downloader.postWithContentTypeJson(REVIEWS_API_URL, emptyMap, eVar.d().getBytes(StandardCharsets.UTF_8)).responseBody()); } catch (IOException | ReCaptchaException e) { throw new ParsingException("Could not fetch reviews", e); } } private String getNextPageToken(C0230a c0230a) { return (String) c0230a.stream().filter(new a(7)).map(new l(17)).map(new l(18)).reduce(new b(2)).orElseThrow(new R5.a(8)); } private String getTrackId() { h hVar = this.document; hVar.getClass(); Q5.b.n("meta[name=bc-page-properties]"); o k6 = q.k("meta[name=bc-page-properties]"); k6.c(); return Long.toString(JsonUtils.toJsonObject(((p) AbstractC1888a.p(hVar, p.class).filter(new org.schabi.newpipe.extractor.localization.b(k6, hVar, 2)).findFirst().orElse(null)).c("content")).e(0L, "item_id")); } public static String lambda$getNextPageToken$1(String str, String str2) { return str2; } public static ParsingException lambda$getNextPageToken$2() { return new ParsingException("Could not get token"); } @Override public ListExtractor.InfoItemsPage<CommentsInfoItem> getInitialPage() { CommentsInfoItemsCollector commentsInfoItemsCollector = new CommentsInfoItemsCollector(getServiceId()); c jsonObject = JsonUtils.toJsonObject(this.document.I("collectors-data").c("data-blob")); C0230a b7 = jsonObject.b("reviews"); Iterator<E> it = b7.iterator(); while (it.hasNext()) { commentsInfoItemsCollector.commit((CommentsInfoItemExtractor) new BandcampCommentsInfoItemExtractor((c) it.next(), getUrl())); } if (!jsonObject.c("more_reviews_available")) { return new ListExtractor.InfoItemsPage<>(commentsInfoItemsCollector, null); } Object[] objArr = {getTrackId(), getNextPageToken(b7)}; ArrayList arrayList = new ArrayList(2); for (int i5 = 0; i5 < 2; i5++) { Object obj = objArr[i5]; Objects.requireNonNull(obj); arrayList.add(obj); } return new ListExtractor.InfoItemsPage<>(commentsInfoItemsCollector, new Page((List<String>) Collections.unmodifiableList(arrayList))); } @Override public ListExtractor.InfoItemsPage<CommentsInfoItem> getPage(Page page) { CommentsInfoItemsCollector commentsInfoItemsCollector = new CommentsInfoItemsCollector(getServiceId()); List<String> ids = page.getIds(); String str = ids.get(0); c fetchReviewsData = fetchReviewsData(str, ids.get(1)); C0230a b7 = fetchReviewsData.b("results"); Iterator<E> it = b7.iterator(); while (it.hasNext()) { commentsInfoItemsCollector.commit((CommentsInfoItemExtractor) new BandcampCommentsInfoItemExtractor((c) it.next(), getUrl())); } if (!fetchReviewsData.c("more_available")) { return new ListExtractor.InfoItemsPage<>(commentsInfoItemsCollector, null); } Object[] objArr = {str, getNextPageToken(b7)}; ArrayList arrayList = new ArrayList(2); for (int i5 = 0; i5 < 2; i5++) { Object obj = objArr[i5]; Objects.requireNonNull(obj); arrayList.add(obj); } return new ListExtractor.InfoItemsPage<>(commentsInfoItemsCollector, new Page((List<String>) Collections.unmodifiableList(arrayList))); } @Override public boolean isCommentsDisabled() { return BandcampExtractorHelper.isRadioUrl(getUrl()); } @Override public void onFetchPage(Downloader downloader) { this.document = AbstractC2363a.w(downloader.get(getLinkHandler().getUrl()).responseBody()); } }