Note that there are some explanatory texts on larger screens.

plurals
  1. POWay to get more than 999 results from a Youtube video feed?
    text
    copied!<p>I'm writing right now a bachelorthesis about the Long Tail and want to get data to research it's behaviour. That's why I wanted to retrieve information on the viewcounts of youtube videos. The only problem is that one video feed to a specific topic like "most_popular" has only 999 entries. Is there a way to retrieve more data to a specific category or in general? I'll post my current code (it's a try to retrieve data for the category "sports") here:</p> <pre><code>public static void printVideoEntry(VideoEntry videoEntry, boolean detailed) { System.out.println("Title: " + videoEntry.getTitle().getPlainText()); if(videoEntry.isDraft()) { System.out.println("Video is not live"); YtPublicationState pubState = videoEntry.getPublicationState(); if(pubState.getState() == YtPublicationState.State.PROCESSING) { System.out.println("Video is still being processed."); } else if(pubState.getState() == YtPublicationState.State.REJECTED) { System.out.print("Video has been rejected because: "); System.out.println(pubState.getDescription()); System.out.print("For help visit: "); System.out.println(pubState.getHelpUrl()); } else if(pubState.getState() == YtPublicationState.State.FAILED) { System.out.print("Video failed uploading because: "); System.out.println(pubState.getDescription()); System.out.print("For help visit: "); System.out.println(pubState.getHelpUrl()); } } if(videoEntry.getEditLink() != null) { System.out.println("Video is editable by current user."); } if(detailed) { YtStatistics stats = videoEntry.getStatistics(); if(stats != null ) { System.out.println("View count: " + stats.getViewCount()); } System.out.println(); } } public static void printVideoFeed(VideoFeed videoFeed, boolean detailed) { for(VideoEntry videoEntry : videoFeed.getEntries() ) { printVideoEntry(videoEntry, detailed); } } public static void printEntireVideoFeed(YouTubeService service, VideoFeed videoFeed, boolean detailed) throws MalformedURLException, IOException, ServiceException { do { printVideoFeed(videoFeed, detailed); if(videoFeed.getNextLink() != null) { videoFeed = service.getFeed(new URL(videoFeed.getNextLink().getHref()), VideoFeed.class); } else { videoFeed = null; } } while(videoFeed != null); } public static void main(String[] args) { try { YouTubeService service = new YouTubeService("test"); YouTubeQuery query = new YouTubeQuery(new URL("http://gdata.youtube.com/feeds/api/videos")); query.setFullTextQuery("Sports"); VideoFeed videoFeed = service.query(query, VideoFeed.class); printEntireVideoFeed(service, videoFeed, false); } catch(AuthenticationException e) { e.printStackTrace(); } catch(MalformedURLException e) { e.printStackTrace(); } catch(ServiceException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload