From 61471fdd3c5d42a7b5685d0691135780c70ee191 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 5 Feb 2016 13:34:44 +0100 Subject: [PATCH] renamed UrlIdHandler into VideoUrlIdHandler --- .../org/schabi/newpipe/crawler/StreamingService.java | 2 +- .../org/schabi/newpipe/crawler/VideoExtractor.java | 3 +-- .../java/org/schabi/newpipe/crawler/VideoInfo.java | 2 +- .../{UrlIdHandler.java => VideoUrlIdHandler.java} | 4 ++-- .../crawler/services/youtube/YoutubeService.java | 8 ++++---- .../services/youtube/YoutubeVideoExtractor.java | 11 ++++------- ...rlIdHandler.java => YoutubeVideoUrlIdHandler.java} | 6 +++--- 7 files changed, 16 insertions(+), 20 deletions(-) rename app/src/main/java/org/schabi/newpipe/crawler/{UrlIdHandler.java => VideoUrlIdHandler.java} (93%) rename app/src/main/java/org/schabi/newpipe/crawler/services/youtube/{YoutubeUrlIdHandler.java => YoutubeVideoUrlIdHandler.java} (92%) diff --git a/app/src/main/java/org/schabi/newpipe/crawler/StreamingService.java b/app/src/main/java/org/schabi/newpipe/crawler/StreamingService.java index f34a40db8..9b6f4e285 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/StreamingService.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/StreamingService.java @@ -31,7 +31,7 @@ public interface StreamingService { throws IOException, CrawlingException; SearchEngine getSearchEngineInstance(); - UrlIdHandler getUrlIdHandler(); + VideoUrlIdHandler getUrlIdHandler(); } diff --git a/app/src/main/java/org/schabi/newpipe/crawler/VideoExtractor.java b/app/src/main/java/org/schabi/newpipe/crawler/VideoExtractor.java index 41a63ebdb..eb336b5ae 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/VideoExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/VideoExtractor.java @@ -20,7 +20,6 @@ package org.schabi.newpipe.crawler; * along with NewPipe. If not, see . */ -import java.net.URL; import java.util.Vector; /**Scrapes information from a video streaming service (eg, YouTube).*/ @@ -73,6 +72,6 @@ public interface VideoExtractor { public abstract int getDislikeCount() throws ParsingException; public abstract VideoPreviewInfo getNextVideo() throws ParsingException; public abstract Vector getRelatedVideos() throws ParsingException; - public abstract UrlIdHandler getUrlIdConverter(); + public abstract VideoUrlIdHandler getUrlIdConverter(); public abstract String getPageUrl(); } diff --git a/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java b/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java index 71503b271..d5f10553f 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java @@ -33,7 +33,7 @@ public class VideoInfo extends AbstractVideoInfo { throws CrawlingException, IOException { VideoInfo videoInfo = new VideoInfo(); - UrlIdHandler uiconv = extractor.getUrlIdConverter(); + VideoUrlIdHandler uiconv = extractor.getUrlIdConverter(); videoInfo.webpage_url = extractor.getPageUrl(); videoInfo.title = extractor.getTitle(); diff --git a/app/src/main/java/org/schabi/newpipe/crawler/UrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/crawler/VideoUrlIdHandler.java similarity index 93% rename from app/src/main/java/org/schabi/newpipe/crawler/UrlIdHandler.java rename to app/src/main/java/org/schabi/newpipe/crawler/VideoUrlIdHandler.java index 5ff0a2b7d..66d8c3cd8 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/UrlIdHandler.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/VideoUrlIdHandler.java @@ -4,7 +4,7 @@ package org.schabi.newpipe.crawler; * Created by Christian Schabesberger on 02.02.16. * * Copyright (C) Christian Schabesberger 2016 - * UrlIdHandler.java is part of NewPipe. + * VideoUrlIdHandler.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ package org.schabi.newpipe.crawler; * along with NewPipe. If not, see . */ -public interface UrlIdHandler { +public interface VideoUrlIdHandler { String getVideoUrl(String videoId); String getVideoId(String siteUrl) throws ParsingException; String cleanUrl(String siteUrl) throws ParsingException; diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeService.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeService.java index 40d7d41f7..b49c55b87 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeService.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeService.java @@ -3,7 +3,7 @@ package org.schabi.newpipe.crawler.services.youtube; import org.schabi.newpipe.crawler.CrawlingException; import org.schabi.newpipe.crawler.Downloader; import org.schabi.newpipe.crawler.StreamingService; -import org.schabi.newpipe.crawler.UrlIdHandler; +import org.schabi.newpipe.crawler.VideoUrlIdHandler; import org.schabi.newpipe.crawler.VideoExtractor; import org.schabi.newpipe.crawler.SearchEngine; @@ -40,7 +40,7 @@ public class YoutubeService implements StreamingService { @Override public VideoExtractor getExtractorInstance(String url, Downloader downloader) throws CrawlingException, IOException { - UrlIdHandler urlIdHandler = new YoutubeUrlIdHandler(); + VideoUrlIdHandler urlIdHandler = new YoutubeVideoUrlIdHandler(); if(urlIdHandler.acceptUrl(url)) { return new YoutubeVideoExtractor(url, downloader) ; } @@ -54,7 +54,7 @@ public class YoutubeService implements StreamingService { } @Override - public UrlIdHandler getUrlIdHandler() { - return new YoutubeUrlIdHandler(); + public VideoUrlIdHandler getUrlIdHandler() { + return new YoutubeVideoUrlIdHandler(); } } diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoExtractor.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoExtractor.java index 94d36b30b..744afd48c 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoExtractor.java @@ -1,7 +1,6 @@ package org.schabi.newpipe.crawler.services.youtube; import android.util.Log; -import android.util.Xml; import org.json.JSONException; import org.json.JSONObject; @@ -16,15 +15,13 @@ import org.schabi.newpipe.crawler.CrawlingException; import org.schabi.newpipe.crawler.Downloader; import org.schabi.newpipe.crawler.ParsingException; import org.schabi.newpipe.crawler.RegexHelper; -import org.schabi.newpipe.crawler.UrlIdHandler; +import org.schabi.newpipe.crawler.VideoUrlIdHandler; import org.schabi.newpipe.crawler.VideoExtractor; import org.schabi.newpipe.crawler.MediaFormat; import org.schabi.newpipe.crawler.VideoInfo; import org.schabi.newpipe.crawler.VideoPreviewInfo; -import org.xmlpull.v1.XmlPullParser; import java.io.IOException; -import java.io.StringReader; import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; @@ -81,7 +78,7 @@ public class YoutubeVideoExtractor implements VideoExtractor { // cached values private static volatile String decryptionCode = ""; - UrlIdHandler urlidhandler = new YoutubeUrlIdHandler(); + VideoUrlIdHandler urlidhandler = new YoutubeVideoUrlIdHandler(); String pageUrl = ""; private Downloader downloader; @@ -429,8 +426,8 @@ public class YoutubeVideoExtractor implements VideoExtractor { } @Override - public UrlIdHandler getUrlIdConverter() { - return new YoutubeUrlIdHandler(); + public VideoUrlIdHandler getUrlIdConverter() { + return new YoutubeVideoUrlIdHandler(); } @Override diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeUrlIdHandler.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java similarity index 92% rename from app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeUrlIdHandler.java rename to app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java index d0ccafafa..b9d2b4fe8 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeUrlIdHandler.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeVideoUrlIdHandler.java @@ -2,13 +2,13 @@ package org.schabi.newpipe.crawler.services.youtube; import org.schabi.newpipe.crawler.ParsingException; import org.schabi.newpipe.crawler.RegexHelper; -import org.schabi.newpipe.crawler.UrlIdHandler; +import org.schabi.newpipe.crawler.VideoUrlIdHandler; /** * Created by Christian Schabesberger on 02.02.16. * * Copyright (C) Christian Schabesberger 2016 - * YoutubeUrlIdHandler.java is part of NewPipe. + * YoutubeVideoUrlIdHandler.java is part of NewPipe. * * NewPipe is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ import org.schabi.newpipe.crawler.UrlIdHandler; * along with NewPipe. If not, see . */ -public class YoutubeUrlIdHandler implements UrlIdHandler { +public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler { @SuppressWarnings("WeakerAccess") @Override public String getVideoUrl(String videoId) {