Tuesday, January 17, 2012

[YouTube-API] Re: Retrieving YouTube insight data through API (Java)

Hello Mike,

The Insight URL link is expose on the profile feed, not the uploads
feed. Specifically, you should be setting FEED_URL to

http://gdata.youtube.com/feeds/api/users/default

(you can use "default" instead of the channel name and the appropriate
channel name will automatically be inferred by the API, based on your
authentication credentials).

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Jan 13, 5:56 pm, Mike <mikhild...@gmail.com> wrote:
> Hi,
>
> i'm using code below to get link for getting my channels insight data. but
> i'm getting null as Link.
> can anyone help me to find whats wrong here?
>
> /****** code**********/
>
> public static final String FEED_URL
> =  "http://gdata.youtube.com/feeds/api/users/mychannelname/uploads";  //i
> put my channel's name in 'mychannelname'
>
> String username = "mygmailid";    //here i entered my gmail id
> String password = "mypassword";
> String developerKey
> = "AI39si7ffVeKWbG1k37***********************************************"
> //developer key
>
> YouTubeService service = new YouTubeService( username  ,developerKey);
>  //just put username instead of clientid since client id no longer available
> try {
>       service.setUserCredentials(username, password);
>     } catch (AuthenticationException e) {
>       System.out.println("Invalid login credentials.");
>       System.exit(1);
>     }
>
> Query query = null;
> try {
>            query = new Query(new URL( FEED_URL));
>    } catch (MalformedURLException e) {
>    //TODO Auto-generated catch block
>    e.printStackTrace();
>    }
>
> ChannelFeed channelFeed = null;
>
> try {
>   channelFeed = service.query(query, ChannelFeed.class);
>   } catch (IOException e) {
>       // TODO Auto-generated catch block
>       e.printStackTrace();
>   } catch (ServiceException e) {
>       // TODO Auto-generated catch block
>       e.printStackTrace();
>
> }
>
> System.out.println(channelFeed.getEntries() + ":");
>     System.out.println(" Link :
> "+channelFeed.getLink("http://gdata.youtube.com/schemas/2007#insight.views",
> "text/html") + ":");
>
> /*****************END*********************/
>
> i'm getting null as Link here
>
> can anyone help me here to find what went wrong here?
>
> Thanks,
> Mike

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment