Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
/ tubescrape Public archive

A java library that scrapes the youtube-search webpage.

License

Notifications You must be signed in to change notification settings

Carcons/tubescrape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

tubescrape

A java library that scrapes the youtube-search webpage.

Download source code and compile java classes:

javac carcons/tubescrape/*.java

Then create the jar library:

jar cf tubescrape.jar carcons/tubescrape/*.class

In your app you can implement the jar and use it:

import carcons.tubescrape.ScrapeOnFinishListener;
import carcons.tubescrape.TubeMedia;
import carcons.tubescrape.TubeScraper;
import java.util.ArrayList;
import java.util.Scanner;

public class App {
    public static void main(String[] args) {
        try {
            Scanner s = new Scanner(System.in);
            System.out.print("Search on youtube: ");
            String query = s.nextLine();
            s.close();
            new TubeScraper(query, new ScrapeOnFinishListener() {
                @Override
                public void OnFinish(ArrayList<TubeMedia> arg0) {
                    System.out.println("Found: " + arg0.size() + " elements.");
                    for (TubeMedia m : arg0) {
                        System.out.print("Title: " + m.getTitle() + "\nUrl: " + m.getYouTubeUrl() + "\n\n");
                    }
                }
            }).scrape();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

The OnFinish method allows you to use the searched results

new TubeScraper(query, new ScrapeOnFinishListener() {
    @Override
    public void OnFinish(ArrayList<TubeMedia> arg0) {
        //The arg0 arraylist contains the finded media.
    }
}).scrape();

About

A java library that scrapes the youtube-search webpage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages