MD5 校验值:61e58c10a11e4adec8760ee3854e996a
YoutubeSubscriptionExtractor.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package org.schabi.newpipe.extractor.services.youtube.extractors; import V1.z; import a4.C0230a; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.services.youtube.YoutubeService; import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor; import org.schabi.newpipe.extractor.subscription.SubscriptionItem; import org.schabi.newpipe.extractor.utils.Utils; import p4.r; public class YoutubeSubscriptionExtractor extends SubscriptionExtractor { private static final String BASE_CHANNEL_URL = "https://www.youtube.com/channel/"; public YoutubeSubscriptionExtractor(YoutubeService youtubeService) { super(youtubeService, Collections.singletonList(SubscriptionExtractor.ContentSource.INPUT_STREAM)); } public List<SubscriptionItem> fromCsvInputStream(InputStream inputStream) { int i5; ArrayList arrayList; int i6; int indexOf; String str = ""; try { try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); try { arrayList = new ArrayList(); i5 = 1; } catch (Throwable th) { th = th; i5 = 0; } try { bufferedReader.readLine(); while (true) { str = bufferedReader.readLine(); if (str == null || ((i5 = i5 + 1) > 5 && arrayList.size() == 0)) { break; } int indexOf2 = str.indexOf(","); if (indexOf2 != -1 && (indexOf = str.indexOf(",", (i6 = indexOf2 + 1))) != -1) { int i7 = indexOf + 1; int indexOf3 = str.indexOf(",", i7); if (indexOf3 == -1) { indexOf3 = str.length(); } String replace = str.substring(i6, indexOf).replace(Utils.HTTP, Utils.HTTPS); if (replace.startsWith(BASE_CHANNEL_URL)) { arrayList.add(new SubscriptionItem(this.service.getServiceId(), replace, str.substring(i7, indexOf3))); } } } bufferedReader.close(); return arrayList; } catch (Throwable th2) { th = th2; try { bufferedReader.close(); } catch (Throwable th3) { th.addSuppressed(th3); } throw th; } } catch (IOException e) { e = e; if (str == null) { if (str.length() > 10) { str = r.h(str.substring(0, 10), "..."); } } else { str = "<null>"; } throw new SubscriptionExtractor.InvalidSourceException("Error reading CSV file on line = \"" + str + "\", line number = " + i5, e); } } catch (IOException e7) { e = e7; i5 = 0; if (str == null) { } throw new SubscriptionExtractor.InvalidSourceException("Error reading CSV file on line = \"" + str + "\", line number = " + i5, e); } } @Override public List<SubscriptionItem> fromInputStream(InputStream inputStream) { return fromJsonInputStream(inputStream); } public List<SubscriptionItem> fromJsonInputStream(InputStream inputStream) { try { C0230a c0230a = (C0230a) new z(new a4.g(inputStream)).j(C0230a.class); ArrayList arrayList = new ArrayList(); Iterator<E> it = c0230a.iterator(); boolean z6 = false; while (it.hasNext()) { Object next = it.next(); if (next instanceof a4.c) { a4.c f7 = ((a4.c) next).f("snippet"); String h6 = f7.f("resourceId").h("channelId", ""); if (h6.length() == 24) { arrayList.add(new SubscriptionItem(this.service.getServiceId(), BASE_CHANNEL_URL.concat(h6), f7.h("title", ""))); } } z6 = true; } if (z6 && arrayList.isEmpty()) { throw new SubscriptionExtractor.InvalidSourceException("Found only invalid channel ids"); } return arrayList; } catch (a4.d e) { throw new SubscriptionExtractor.InvalidSourceException("Invalid json input stream", e); } } public List<SubscriptionItem> fromZipInputStream(InputStream inputStream) { try { ZipInputStream zipInputStream = new ZipInputStream(inputStream); while (true) { try { ZipEntry nextEntry = zipInputStream.getNextEntry(); if (nextEntry == null) { zipInputStream.close(); throw new SubscriptionExtractor.InvalidSourceException("Unable to find a valid subscriptions.csv file (try extracting and selecting the csv file)"); } if (nextEntry.getName().toLowerCase().endsWith(".csv")) { try { List<SubscriptionItem> fromCsvInputStream = fromCsvInputStream(zipInputStream); if (fromCsvInputStream.size() > 0) { zipInputStream.close(); return fromCsvInputStream; } } catch (ExtractionException unused) { continue; } } } finally { } } } catch (IOException e) { throw new SubscriptionExtractor.InvalidSourceException("Error reading contents of zip file", e); } } @Override public String getRelatedUrl() { return "https://takeout.google.com/takeout/custom/youtube"; } @Override public List<SubscriptionItem> fromInputStream(InputStream inputStream, String str) { str.getClass(); char c7 = 65535; switch (str.hashCode()) { case -2135895576: if (str.equals("text/comma-separated-values")) { c7 = 0; break; } break; case -1248325150: if (str.equals("application/zip")) { c7 = 1; break; } break; case -1004747228: if (str.equals("text/csv")) { c7 = 2; break; } break; case -43840953: if (str.equals("application/json")) { c7 = 3; break; } break; case 98822: if (str.equals("csv")) { c7 = 4; break; } break; case 120609: if (str.equals("zip")) { c7 = 5; break; } break; case 3271912: if (str.equals("json")) { c7 = 6; break; } break; } switch (c7) { case 0: case 2: case 4: return fromCsvInputStream(inputStream); case 1: case 5: return fromZipInputStream(inputStream); case 3: case 6: return fromJsonInputStream(inputStream); default: throw new SubscriptionExtractor.InvalidSourceException("Unsupported content type: ".concat(str)); } } }