20

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?

Jaap
  • 81,064
  • 34
  • 182
  • 193
user3711987
  • 303
  • 2
  • 9

1 Answers1

36

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.

azelez
  • 2,501
  • 2
  • 27
  • 26