本文整理汇总了Java中com.github.axet.vget.VGet.download方法的典型用法代码示例。如果您正苦于以下问题:Java VGet.download方法的具体用法?Java VGet.download怎么用?Java VGet.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.axet.vget.VGet
的用法示例。
在下文中一共展示了VGet.download方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: map
import com.github.axet.vget.VGet; //导入方法依赖的package包/类
public void map(LongWritable key, Text url, OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
File videoDownloadDir = Files.createTempDir();
VGet v = new VGet(new URL(url.toString()), videoDownloadDir);
v.download();
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
File[] videoFiles = videoDownloadDir.listFiles();
Arrays.sort(videoFiles);
File[] videoFramesFiles = VideoProcessing.parseVideo(videoFiles[0], 70);
File[] processedVideoFrames = VideoProcessing.cutImages(videoFramesFiles);
Tesseract instance = Tesseract.getInstance();
instance.setDatapath("/usr/share/tesseract-ocr");
instance.setTessVariable("LC_NUMERIC", "C");
for (File image: processedVideoFrames) {
String result = null;
try {
result = instance.doOCR(image);
} catch (TesseractException e) {
e.printStackTrace();
}
if (!result.isEmpty()) {
word.set(result);
output.collect(url, word);
}
}
}
示例2: downloadVideo
import com.github.axet.vget.VGet; //导入方法依赖的package包/类
/**
* Download video from youtube
*
* @param url Youtube url
* @return name of video
*/
public static File downloadVideo(String url)
{
try
{
VGet v = new VGet(new URL(url), new File("tmp/"));
VGetParser user = new YouTubeMPGParser();
v.download(user);
DownloadedFileLogger.addYoutubeLink(url, "tmp/" + v.getTarget().getName());
return v.getTarget();
}
catch (Exception | NoClassDefFoundError e)
{
Log.stackTrace(e.getStackTrace());
return null;
}
}
示例3: doDownload
import com.github.axet.vget.VGet; //导入方法依赖的package包/类
public void doDownload(VGet v, VGetParser user, VGetStatus notify, AtomicBoolean stop) {
v.download(user, stop, notify);
}
示例4: get
import com.github.axet.vget.VGet; //导入方法依赖的package包/类
/**
* Gets a youtube video at the given url
*
* @param url - Youtube url
* @return - Title of the video
* @throws Exception - We really need to generalize these exceptions
*/
public static String get(URL url) throws Exception {
//initates a VGet object with the temp directory, creating it if necessary
File temp = new File(EzHttp.TEMP_LOCATION);
temp.mkdir();
VGet axetGetter = new VGet(url, temp);
axetGetter.download(); //starts the download
System.out.println("YT source: " + axetGetter.getVideo().getSource().toString()); //debug print
//Determine whether one or two files were downloaded
List<VideoFileInfo> info = axetGetter.getVideo().getInfo();
int files = info.size();
//more debug printouts
System.out.println(files);
System.out.println(info.get(0).getTarget().getAbsolutePath());
String title = axetGetter.getVideo().getTitle(); //title of video
/**
* By default, vget downloads either one or two files - either a webm with both video and audio in it for less
* secure videos, or seperate video and audio streams as an mp4 and webm file respectively.
*
* The following code block processes these files based on how many were downloaded, and packages them into a
* nice single mp4 file in the actual download directory that the user specified.
*/
if (files == 1) {
Converter converter = new Converter();
converter.convert(info.get(0).getTarget().getAbsoluteFile(), EzHttp.getDownloadLocation(), EzHttp.cleanseName(title) + ".mp4");
} else if (files == 2) {
Merge merger = new Merge();
merger.merge(
info.get(0).getTarget().getAbsoluteFile(),
info.get(1).getTarget().getAbsoluteFile(),
new File(EzHttp.getDownloadLocation()).getAbsolutePath(),
EzHttp.cleanseName(title) + ".mp4"
);
}
return title;
}