Reputation: 3016
I am using the gdata-src.java-1.47.1 java client api and using the online developer guide. My problem is that in the online developer guide the getFeed (URL,String)
method is called from a service instance to fetch the video feed e.g
VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
I am assuming that the service instance is of the YouTubeService class. But when I create a instance of this class there isn't any getFeed (URL,String)
method. What class does this method belong to or what other alternatives can I use to fetch the VideoFeed
.
Upvotes: 0
Views: 619
Reputation: 79
http://www.java2s.com/Code/Jar/g/
Downloadgdatayoutubemeta20jar.htm
Similarly you will find all the JARs on the same page - Click the page and download the jar.ZIP file
I am not sure, why these libs are not available for download straight away
Upvotes: -1
Reputation: 2240
Are you importing the right JARs? I'm not sure how you're getting this error.
I imported these JARs:
gdata-client-1.0.jar
gdata-core-1.0.jar
gdata-youtube-2.0.jar
guava-11.0.2.jar
mail.jar
gdata-client-meta-1.0.jar
gdata-media-1.0.jar
gdata-youtube-meta-2.0.jar
jsr305.jar
When you unzip the GData zip file, these are found in gdata/java/lib. The dependencies are found in gdata/java/deps, and mail.jar is found here.
I have these imports:
import com.google.gdata.client.youtube.YouTubeService;
import com.google.gdata.data.geo.impl.GeoRssWhere;
import com.google.gdata.data.media.mediarss.MediaKeywords;
import com.google.gdata.data.media.mediarss.MediaPlayer;
import com.google.gdata.data.media.mediarss.MediaThumbnail;
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.YouTubeMediaRating;
import com.google.gdata.data.youtube.YtPublicationState;
import com.google.gdata.data.youtube.YtStatistics;
import com.google.gdata.util.ServiceException;
My code is below. I'm omitting the print functions. Also, I am using ClientLogin for simplicity of the sample code - do not use ClientLogin in a real application
String feedUrl = "http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed";
YouTubeService service = new YouTubeService("youtube", "DEVELOPER_KEY_HERE");
service.setUserCredentials("[email protected]", "YOUR_PASSWORD_HERE");
VideoFeed videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
printVideoFeed(videoFeed, true);
Note that if possible, you should be looking at the v3 API.
Upvotes: 2