Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me how I can able to download YouTube videos using Java?

1 Answer

0 votes
by (26.7k points)

You can use the below code to download YouTube videos:

package com.mycompany.ytd;

import java.io.File;

import java.net.URL;

import com.github.axet.vget.VGet;

/**

 *

 * @author Manindar

 */

public class YTD {

    public static void main(String[] args) {

        try {

            String url = "watch?v=s10ARdfQU";

            String path = "D:\\Manindar\\YTD\\";

            VGet v = new VGet(new URL(url), new File(path));

            v.download();

        } catch (Exception e) {

            throw new RuntimeException(e);

        }

    }

}

Also, you need to add the dependency in POM.XML file:

<dependency>

            <groupId>com.github.axet</groupId>

            <artifactId>vget</artifactId>

            <version>1.1.33</version>

        </dependency>

I hope this will help.

Want to become a Java Expert? Join Java Course now!!

Related questions

0 votes
0 answers
0 votes
1 answer
0 votes
1 answer
0 votes
0 answers
asked Oct 26, 2020 in SEO by dev_sk2311 (45k points)

Browse Categories

...