Skip to content
/ RXTube Public

YouTube REST API Wrapper based on RxJava and Retrofit

License

Notifications You must be signed in to change notification settings

hsuaxo/RXTube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RxTube

YouTube REST API wrapper based on RxJava and Retrofit

INSTALLATION

Gradle
compile 'com.hsuaxo:rxtube:1.0.3'
Maven
<dependency>
    <groupId>com.hsuaxo</groupId>
    <artifactId>rxtube</artifactId>
    <version>1.0.3</version>
    <type>jar</type>
</dependency>

USAGE

final RxTube tube = new RxTube("YOUR_YOUTUBE_API_KEY");
tube.search(YTContentType.ANY, "cats in boxes", 50).subscribe(new YTObserver() {
    @Override
    public void onSubscribe(Disposable d) {
        System.out.println("SUBSCRIBED");
    }

    @Override
    public void onSuccess(YTResult r) {
        r.items.forEach((item) -> {
            System.out.println(item.type() + " / " + item.name() + " / " + item.url());
        });
    }

    @Override
    public void onError(Throwable e) {
        System.out.println("ERROR: " + e.getMessage());
    }
});

SEARCH FOR VIDEOS, CHANNELS OR PLAYLISTS

YTContentType.VIDEO
YTContentType.CHANNEL
YTContentType.PLAYLIST

SHORTCUT SEARCH METHODS

Single<YTResult> searchVideos(String searchText, int maxRecords)
Single<YTResult> searchVideos(String searchText)

Single<YTResult> searchChannels(String searchText, int maxRecords)
Single<YTResult> searchChannels(String searchText)

Single<YTResult> searchPlaylists(String searchText, int maxRecords)
Single<YTResult> searchPlaylists(String searchText)

LICENSE

MIT