youtube videos
in
Contributed Library Questions
•
3 years ago
hi,
i'm trying to insert a youtube video in my script. I thought it would be easy, because in JAVA it's allready fully explained.
right now i have this:
tried this too:
i'm trying to insert a youtube video in my script. I thought it would be easy, because in JAVA it's allready fully explained.
right now i have this:
- import com.google.gdata.client.Query;
import com.google.gdata.client.Service;
import com.google.gdata.client.youtube.YouTubeQuery;
import com.google.gdata.client.youtube.YouTubeService;
import com.google.gdata.data.Category;
import com.google.gdata.data.Entry;
import com.google.gdata.data.Feed;
import com.google.gdata.data.TextContent;
import com.google.gdata.data.extensions.Comments;
import com.google.gdata.data.extensions.FeedLink;
import com.google.gdata.data.youtube.FeedLinkEntry;
import com.google.gdata.data.youtube.PlaylistEntry;
import com.google.gdata.data.youtube.PlaylistFeed;
import com.google.gdata.data.youtube.PlaylistLinkEntry;
import com.google.gdata.data.youtube.PlaylistLinkFeed;
import com.google.gdata.data.youtube.SubscriptionEntry;
import com.google.gdata.data.youtube.SubscriptionFeed;
import com.google.gdata.data.youtube.UserProfileEntry;
import com.google.gdata.data.youtube.VideoEntry;
import com.google.gdata.data.youtube.VideoFeed;
import com.google.gdata.data.youtube.YouTubeMediaContent;
import com.google.gdata.data.youtube.YouTubeMediaGroup;
import com.google.gdata.data.youtube.YouTubeNamespace;
import com.google.gdata.util.ServiceException;
import com.google.common.collect.*;
import com.google.gdata.client.*;
import com.google.gdata.client.youtube.*;
import com.google.gdata.data.*;
import com.google.gdata.data.geo.impl.*;
import com.google.gdata.data.media.*;
import com.google.gdata.data.media.mediarss.*;
import com.google.gdata.data.youtube.*;
import com.google.gdata.data.extensions.*;
import com.google.gdata.util.*;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
String developer_key = "xxxxxxxx";
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
String YOUTUBE_URL = "http://gdata.youtube.com/feeds/api/videos";
YouTubeService service;
YouTubeQuery query;
MalformedURLException e;
void setup() {
service = new YouTubeService("xxx","xxxx");
query = new YouTubeQuery(new URL(YOUTUBE_URL));
VideoFeed videoFeed = service.query(query, VideoFeed.class);
printVideoFeed(videoFeed, true);
// order results by the number of views (most viewed first)
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
// do not exclude restricted content from the search
query.setFullTextQuery("puppy");
query.setSafeSearch(YouTubeQuery.SafeSearch.NONE);
}
public static void printVideoFeed(VideoFeed videoFeed, boolean detailed) {
for(VideoEntry videoEntry : videoFeed.getEntries() ) {
printVideoEntry(videoEntry, detailed);
}
}
tried this too:
- try {
query = new YouTubeQuery(new URL(YOUTUBE_URL));
}catch (MalformedURLException e) {
println("ERROR " +e.getMessage());
}
1