renamed UrlIdHandler into VideoUrlIdHandler

This commit is contained in:
Christian Schabesberger 2016-02-05 13:34:44 +01:00
parent 14fb7d8a7a
commit 61471fdd3c
7 changed files with 16 additions and 20 deletions

View file

@ -31,7 +31,7 @@ public interface StreamingService {
throws IOException, CrawlingException;
SearchEngine getSearchEngineInstance();
UrlIdHandler getUrlIdHandler();
VideoUrlIdHandler getUrlIdHandler();
}

View file

@ -20,7 +20,6 @@ package org.schabi.newpipe.crawler;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/
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<VideoPreviewInfo> getRelatedVideos() throws ParsingException;
public abstract UrlIdHandler getUrlIdConverter();
public abstract VideoUrlIdHandler getUrlIdConverter();
public abstract String getPageUrl();
}

View file

@ -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();

View file

@ -4,7 +4,7 @@ package org.schabi.newpipe.crawler;
* Created by Christian Schabesberger on 02.02.16.
*
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* 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 <http://www.gnu.org/licenses/>.
*/
public interface UrlIdHandler {
public interface VideoUrlIdHandler {
String getVideoUrl(String videoId);
String getVideoId(String siteUrl) throws ParsingException;
String cleanUrl(String siteUrl) throws ParsingException;

View file

@ -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();
}
}

View file

@ -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

View file

@ -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 <chris.schabesberger@mailbox.org>
* 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 <http://www.gnu.org/licenses/>.
*/
public class YoutubeUrlIdHandler implements UrlIdHandler {
public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler {
@SuppressWarnings("WeakerAccess")
@Override
public String getVideoUrl(String videoId) {