renamed UrlIdHandler into VideoUrlIdHandler
This commit is contained in:
parent
14fb7d8a7a
commit
61471fdd3c
7 changed files with 16 additions and 20 deletions
|
@ -31,7 +31,7 @@ public interface StreamingService {
|
||||||
throws IOException, CrawlingException;
|
throws IOException, CrawlingException;
|
||||||
SearchEngine getSearchEngineInstance();
|
SearchEngine getSearchEngineInstance();
|
||||||
|
|
||||||
UrlIdHandler getUrlIdHandler();
|
VideoUrlIdHandler getUrlIdHandler();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.schabi.newpipe.crawler;
|
||||||
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/**Scrapes information from a video streaming service (eg, YouTube).*/
|
/**Scrapes information from a video streaming service (eg, YouTube).*/
|
||||||
|
@ -73,6 +72,6 @@ public interface VideoExtractor {
|
||||||
public abstract int getDislikeCount() throws ParsingException;
|
public abstract int getDislikeCount() throws ParsingException;
|
||||||
public abstract VideoPreviewInfo getNextVideo() throws ParsingException;
|
public abstract VideoPreviewInfo getNextVideo() throws ParsingException;
|
||||||
public abstract Vector<VideoPreviewInfo> getRelatedVideos() throws ParsingException;
|
public abstract Vector<VideoPreviewInfo> getRelatedVideos() throws ParsingException;
|
||||||
public abstract UrlIdHandler getUrlIdConverter();
|
public abstract VideoUrlIdHandler getUrlIdConverter();
|
||||||
public abstract String getPageUrl();
|
public abstract String getPageUrl();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class VideoInfo extends AbstractVideoInfo {
|
||||||
throws CrawlingException, IOException {
|
throws CrawlingException, IOException {
|
||||||
VideoInfo videoInfo = new VideoInfo();
|
VideoInfo videoInfo = new VideoInfo();
|
||||||
|
|
||||||
UrlIdHandler uiconv = extractor.getUrlIdConverter();
|
VideoUrlIdHandler uiconv = extractor.getUrlIdConverter();
|
||||||
|
|
||||||
videoInfo.webpage_url = extractor.getPageUrl();
|
videoInfo.webpage_url = extractor.getPageUrl();
|
||||||
videoInfo.title = extractor.getTitle();
|
videoInfo.title = extractor.getTitle();
|
||||||
|
|
|
@ -4,7 +4,7 @@ package org.schabi.newpipe.crawler;
|
||||||
* Created by Christian Schabesberger on 02.02.16.
|
* Created by Christian Schabesberger on 02.02.16.
|
||||||
*
|
*
|
||||||
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
* 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
|
* NewPipe is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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/>.
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface UrlIdHandler {
|
public interface VideoUrlIdHandler {
|
||||||
String getVideoUrl(String videoId);
|
String getVideoUrl(String videoId);
|
||||||
String getVideoId(String siteUrl) throws ParsingException;
|
String getVideoId(String siteUrl) throws ParsingException;
|
||||||
String cleanUrl(String siteUrl) throws ParsingException;
|
String cleanUrl(String siteUrl) throws ParsingException;
|
|
@ -3,7 +3,7 @@ package org.schabi.newpipe.crawler.services.youtube;
|
||||||
import org.schabi.newpipe.crawler.CrawlingException;
|
import org.schabi.newpipe.crawler.CrawlingException;
|
||||||
import org.schabi.newpipe.crawler.Downloader;
|
import org.schabi.newpipe.crawler.Downloader;
|
||||||
import org.schabi.newpipe.crawler.StreamingService;
|
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.VideoExtractor;
|
||||||
import org.schabi.newpipe.crawler.SearchEngine;
|
import org.schabi.newpipe.crawler.SearchEngine;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class YoutubeService implements StreamingService {
|
||||||
@Override
|
@Override
|
||||||
public VideoExtractor getExtractorInstance(String url, Downloader downloader)
|
public VideoExtractor getExtractorInstance(String url, Downloader downloader)
|
||||||
throws CrawlingException, IOException {
|
throws CrawlingException, IOException {
|
||||||
UrlIdHandler urlIdHandler = new YoutubeUrlIdHandler();
|
VideoUrlIdHandler urlIdHandler = new YoutubeVideoUrlIdHandler();
|
||||||
if(urlIdHandler.acceptUrl(url)) {
|
if(urlIdHandler.acceptUrl(url)) {
|
||||||
return new YoutubeVideoExtractor(url, downloader) ;
|
return new YoutubeVideoExtractor(url, downloader) ;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class YoutubeService implements StreamingService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UrlIdHandler getUrlIdHandler() {
|
public VideoUrlIdHandler getUrlIdHandler() {
|
||||||
return new YoutubeUrlIdHandler();
|
return new YoutubeVideoUrlIdHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.schabi.newpipe.crawler.services.youtube;
|
package org.schabi.newpipe.crawler.services.youtube;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Xml;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
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.Downloader;
|
||||||
import org.schabi.newpipe.crawler.ParsingException;
|
import org.schabi.newpipe.crawler.ParsingException;
|
||||||
import org.schabi.newpipe.crawler.RegexHelper;
|
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.VideoExtractor;
|
||||||
import org.schabi.newpipe.crawler.MediaFormat;
|
import org.schabi.newpipe.crawler.MediaFormat;
|
||||||
import org.schabi.newpipe.crawler.VideoInfo;
|
import org.schabi.newpipe.crawler.VideoInfo;
|
||||||
import org.schabi.newpipe.crawler.VideoPreviewInfo;
|
import org.schabi.newpipe.crawler.VideoPreviewInfo;
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -81,7 +78,7 @@ public class YoutubeVideoExtractor implements VideoExtractor {
|
||||||
// cached values
|
// cached values
|
||||||
private static volatile String decryptionCode = "";
|
private static volatile String decryptionCode = "";
|
||||||
|
|
||||||
UrlIdHandler urlidhandler = new YoutubeUrlIdHandler();
|
VideoUrlIdHandler urlidhandler = new YoutubeVideoUrlIdHandler();
|
||||||
String pageUrl = "";
|
String pageUrl = "";
|
||||||
|
|
||||||
private Downloader downloader;
|
private Downloader downloader;
|
||||||
|
@ -429,8 +426,8 @@ public class YoutubeVideoExtractor implements VideoExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UrlIdHandler getUrlIdConverter() {
|
public VideoUrlIdHandler getUrlIdConverter() {
|
||||||
return new YoutubeUrlIdHandler();
|
return new YoutubeVideoUrlIdHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,13 +2,13 @@ package org.schabi.newpipe.crawler.services.youtube;
|
||||||
|
|
||||||
import org.schabi.newpipe.crawler.ParsingException;
|
import org.schabi.newpipe.crawler.ParsingException;
|
||||||
import org.schabi.newpipe.crawler.RegexHelper;
|
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.
|
* Created by Christian Schabesberger on 02.02.16.
|
||||||
*
|
*
|
||||||
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
* 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
|
* NewPipe is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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/>.
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class YoutubeUrlIdHandler implements UrlIdHandler {
|
public class YoutubeVideoUrlIdHandler implements VideoUrlIdHandler {
|
||||||
@SuppressWarnings("WeakerAccess")
|
@SuppressWarnings("WeakerAccess")
|
||||||
@Override
|
@Override
|
||||||
public String getVideoUrl(String videoId) {
|
public String getVideoUrl(String videoId) {
|
Loading…
Reference in a new issue