Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having trouble importing "google.api.services.samples.youtube.cmdline.Auth;"?

Tags:

I followed this tutorial https://developers.google.com/youtube/v3/code_samples/java#search_by_keyword

to retreive youtube videos based on keyword using YouTubeData API

This section is giving me the error: "Error:(117, 43) error: cannot find symbol variable auth"

youtube = new YouTube.Builder(Auth.HTTP_TRANSPORT, Auth.JSON_FACTORY, new HttpRequestInitializer() {
                public void initialize(com.google.api.client.http.HttpRequest request) throws IOException {
                }
            })
                    .setApplicationName("youtube-cmdline-search-sample")
                    .build();

I think that this class is not being imported

import com.google.api.services.samples.youtube.cmdline.Auth;

I've searched the internet for someone else having this problem but the question was never answered....can someone please help me?

like image 743
user3711987 Avatar asked Jun 05 '14 16:06

user3711987


1 Answers

These two defines can be found in the youtube example: Auth.java file from example

Are you can just replace the Builder string as follows:

new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), new HttpRequestInitializer() 

This will do the trick, same as finding the defines.

Hopes this helps, BR, Adrian.

like image 102
azelez Avatar answered Sep 18 '22 22:09

azelez