Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试使用vget(Youtube视频下载API)时出错_Java - Fatal编程技术网

Java 尝试使用vget(Youtube视频下载API)时出错

Java 尝试使用vget(Youtube视频下载API)时出错,java,Java,我试图使用axet的vget API下载带有Java的youtube视频,但当我尝试使用带有以下代码的库时: public class testing { public static void main(String[] args) { try { String url = "https://www.youtube.com/watch?v=s10ARdfQUOY"; String path = "C:/Users/Dyla

我试图使用axet的vget API下载带有Java的youtube视频,但当我尝试使用带有以下代码的库时:

public class testing {

    public static void main(String[] args) {
        try {
            String url = "https://www.youtube.com/watch?v=s10ARdfQUOY";
            String path = "C:/Users/Dylan/music";
            VGet v = new VGet(new URL(url), new File(path));
            v.download();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
它只是抛出了这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/utils/URLEncodedUtils
    at com.github.axet.vget.info.YouTubeParser.getQueryMap(YouTubeParser.java:193)
    at com.github.axet.vget.info.YouTubeParser.extractEmbedded(YouTubeParser.java:177)
    at com.github.axet.vget.info.YouTubeParser.downloadone(YouTubeParser.java:59)
    at com.github.axet.vget.info.YouTubeParser.extract(YouTubeParser.java:319)
    at com.github.axet.vget.info.VGetParser.extract(VGetParser.java:15)
    at com.github.axet.vget.info.VideoInfo.extract(VideoInfo.java:98)
    at com.github.axet.vget.VGet.download(VGet.java:206)
    at com.github.axet.vget.VGet.download(VGet.java:63)
    at thingerthing.testing.main(testing.java:20)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.utils.URLEncodedUtils
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more
这是图书馆:


我不确定我是否安装正确。我下载了两个jar文件,wget-1.2.3和vget-1.0.9,并将它们放入我的eclipse项目中

您缺少VGet的依赖项。只需下载
vget-1.0.9
就可以获得该库,而不是它所依赖的内容(在本例中是Apache HTTP)

你能在你的项目中使用Maven吗?将vget添加到您的
pom.xml
将为vget引入所有正确的依赖项以及它们的所有依赖项。这个依赖关系图可能相当大,所以在项目中一个接一个地添加jar可能会花费相当多的时间

如果使用maven,则需要依赖关系:

<dependency>
   <groupId>com.github.axet</groupId>
   <artifactId>vget</artifactId>
   <version>1.1.34</version>
</dependency>

com.github.axet
vget
1.1.34