hi people! (sorry for my bad english in advance .. :) )
im new to this and i hope this is the right place to put my question
to...
im writing a java program, that tries to find similarities between
artists based on occurrences of special words in the youtube-comments
of a video.
i have a list of songs and albums of every artist and based on that
information i search for the corresponding videos and get the feeds
for them to get the information that i need.
here are two methods where i run into the trouble:
public void getYoutubeSongs(String artist_name, YouTubeService
service) throws IOException,
ServiceException {
System.out.println("... getting songs-infos from Youtube ...");
YouTubeQuery query = new YouTubeQuery(new URL(
"http://gdata.youtube.com/feeds/api/videos"));
// order results by the number of views (most viewed first)
query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
VideoFeed videoFeed;
Query.CategoryFilter categoryFilter1 = new Query.CategoryFilter();
// this restricts to videos in the category of "Music".
categoryFilter1.addCategory(new Category(
YouTubeNamespace.CATEGORY_SCHEME, "Music"));
// multiple filters mean "AND" in a category query
query.addCategoryFilter(categoryFilter1);
// query.addCategoryFilter(categoryFilter2);
for (String song : this.songs) {
query.setFullTextQuery(artist_name + " " + song);
videoFeed = service.query(query, VideoFeed.class);
// iterate over each videoEntry and fetch comments and tags
this.fetchYoutubeCommentsAndTags(videoFeed, service);
}
}
/**
* fetches all keywords and comments from the given video-feed.
* the tag-occurrences are counted.
* @param videoFeed the videoFeed to iterate over
* @param service the service to operate on
*/
public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
YouTubeService service) throws IOException, ServiceException {
int oldVal;
// iterate over each videoEntry
CommentFeed commentFeed;
for (VideoEntry videoEntry : videoFeed.getEntries()) {
YouTubeMediaGroup mediaGroup = videoEntry.getMediaGroup();
MediaKeywords keywords = mediaGroup.getKeywords();
// fetch all keywords of the videoEntry (and count the occurrences)
for (String keyword : keywords.getKeywords()) {
keyword = Stuff.normalizeKeyword(keyword.toLowerCase());
if (!youtubeTags.containsKey(keyword)) {
youtubeTags.put(keyword, 1);// first occurrence
} else {
oldVal = youtubeTags.get(keyword);
youtubeTags.put(keyword, oldVal + 1);// tag already inserted
}
}
// only store different comments
for (CommentEntry comment : commentFeed.getEntries()) {
if (!youtubeComments
.contains(comment.getPlainTextContent())) {
youtubeComments.add(comment.getPlainTextContent());
}
}
}
}
}
at the moment im only trying my program with 1 artist. for every
artist there are about 20 albums and 50 songs. (just to give you a
dimension...)
for getting the information for the artist itself and for the albums
there is another method pretty similar to the getYoutubeSongs() -
method
i hope someone can tell me where the problem is. i mean the error-msg
seems quite clear, but i cannot imagine that there is really no way to
realize what im planning to do...
On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at> wrote:
> hi people! (sorry for my bad english in advance .. :) )
> im new to this and i hope this is the right place to put my question
> to...
> im writing a java program, that tries to find similarities between
> artists based on occurrences of special words in the youtube-comments
> of a video.
> i have a list of songs and albums of every artist and based on that
> information i search for the corresponding videos and get the feeds
> for them to get the information that i need.
> here are two methods where i run into the trouble:
> System.out.println("... getting songs-infos from Youtube
> ...");
> YouTubeQuery query = new YouTubeQuery(new URL(
> "http://gdata.youtube.com/feeds/api/videos"));
> // order results by the number of views (most viewed first)
> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
> VideoFeed videoFeed;
> Query.CategoryFilter categoryFilter1 = new
> Query.CategoryFilter();
> // this restricts to videos in the category of "Music".
> categoryFilter1.addCategory(new Category(
> YouTubeNamespace.CATEGORY_SCHEME, "Music"));
> // multiple filters mean "AND" in a category query
> query.addCategoryFilter(categoryFilter1);
> // query.addCategoryFilter(categoryFilter2);
> for (String song : this.songs) {
> query.setFullTextQuery(artist_name + " " + song);
> videoFeed = service.query(query, VideoFeed.class);
> // iterate over each videoEntry and fetch comments
> and tags
> this.fetchYoutubeCommentsAndTags(videoFeed,
> service);
> }
> }
> /**
> * fetches all keywords and comments from the given video-feed.
> * the tag-occurrences are counted.
> * @param videoFeed the videoFeed to iterate over
> * @param service the service to operate on
> */
> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
> YouTubeService service) throws IOException,
> ServiceException {
> int oldVal;
> // iterate over each videoEntry
> CommentFeed commentFeed;
> for (VideoEntry videoEntry : videoFeed.getEntries()) {
> YouTubeMediaGroup mediaGroup =
> videoEntry.getMediaGroup();
> MediaKeywords keywords = mediaGroup.getKeywords();
> // fetch all keywords of the videoEntry (and count
> the occurrences)
> for (String keyword : keywords.getKeywords()) {
> keyword =
> Stuff.normalizeKeyword(keyword.toLowerCase());
> if (!youtubeTags.containsKey(keyword)) {
> youtubeTags.put(keyword, 1);// first
> occurrence
> } else {
> oldVal = youtubeTags.get(keyword);
> youtubeTags.put(keyword, oldVal +
> 1);// tag already inserted
> }
> }
> at the moment im only trying my program with 1 artist. for every
> artist there are about 20 albums and 50 songs. (just to give you a
> dimension...)
> for getting the information for the artist itself and for the albums
> there is another method pretty similar to the getYoutubeSongs() -
> method
> i hope someone can tell me where the problem is. i mean the error-msg
> seems quite clear, but i cannot imagine that there is really no way to
> realize what im planning to do...
> Throw in some Thread.sleep() statements perhaps? :)
> Cheers,
> -Jeff
> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at > <mailto:daniel_thal...@gmx.at>> wrote:
> hi people! (sorry for my bad english in advance .. :) )
> im new to this and i hope this is the right place to put my question
> to...
> im writing a java program, that tries to find similarities between
> artists based on occurrences of special words in the youtube-comments
> of a video.
> i have a list of songs and albums of every artist and based on that
> information i search for the corresponding videos and get the feeds
> for them to get the information that i need.
> here are two methods where i run into the trouble:
> System.out.println("... getting songs-infos from
> Youtube ...");
> YouTubeQuery query = new YouTubeQuery(new URL(
> "http://gdata.youtube.com/feeds/api/videos"));
> // order results by the number of views (most
> viewed first)
> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
> VideoFeed videoFeed;
> Query.CategoryFilter categoryFilter1 = new
> Query.CategoryFilter();
> // this restricts to videos in the category of "Music".
> categoryFilter1.addCategory(new Category(
> YouTubeNamespace.CATEGORY_SCHEME,
> "Music"));
> // multiple filters mean "AND" in a category query
> query.addCategoryFilter(categoryFilter1);
> // query.addCategoryFilter(categoryFilter2);
> for (String song : this.songs) {
> query.setFullTextQuery(artist_name + " " +
> song);
> videoFeed = service.query(query,
> VideoFeed.class);
> // iterate over each videoEntry and fetch
> comments and tags
> this.fetchYoutubeCommentsAndTags(videoFeed,
> service);
> }
> }
> /**
> * fetches all keywords and comments from the given video-feed.
> * the tag-occurrences are counted.
> * @param videoFeed the videoFeed to iterate over
> * @param service the service to operate on
> */
> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
> YouTubeService service) throws IOException,
> ServiceException {
> int oldVal;
> // iterate over each videoEntry
> CommentFeed commentFeed;
> for (VideoEntry videoEntry : videoFeed.getEntries()) {
> YouTubeMediaGroup mediaGroup =
> videoEntry.getMediaGroup();
> MediaKeywords keywords =
> mediaGroup.getKeywords();
> // fetch all keywords of the videoEntry
> (and count the occurrences)
> for (String keyword : keywords.getKeywords()) {
> keyword =
> Stuff.normalizeKeyword(keyword.toLowerCase());
> if
> (!youtubeTags.containsKey(keyword)) {
> youtubeTags.put(keyword,
> 1);// first occurrence
> } else {
> oldVal =
> youtubeTags.get(keyword);
> youtubeTags.put(keyword,
> oldVal + 1);// tag already inserted
> }
> }
> at the moment im only trying my program with 1 artist. for every
> artist there are about 20 albums and 50 songs. (just to give you a
> dimension...)
> for getting the information for the artist itself and for the albums
> there is another method pretty similar to the getYoutubeSongs() -
> method
> i hope someone can tell me where the problem is. i mean the error-msg
> seems quite clear, but i cannot imagine that there is really no way to
> realize what im planning to do...
> im grateful for every help!
> kind regards,
> daniel
thanks for the reply!
[quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
where should i put them and how long should the thread sleep ... i dont really get what exactly causes my problems....
On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller <daniel_thal...@gmx.at> wrote:
> Jeff Fisher schrieb:
>> Throw in some Thread.sleep() statements perhaps? :)
>> Cheers,
>> -Jeff
>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
>> <mailto:daniel_thal...@gmx.at>> wrote:
>> hi people! (sorry for my bad english in advance .. :) )
>> im new to this and i hope this is the right place to put my question
>> to...
>> im writing a java program, that tries to find similarities between
>> artists based on occurrences of special words in the youtube-comments
>> of a video.
>> i have a list of songs and albums of every artist and based on that
>> information i search for the corresponding videos and get the feeds
>> for them to get the information that i need.
>> here are two methods where i run into the trouble:
>> System.out.println("... getting songs-infos from
>> Youtube ...");
>> YouTubeQuery query = new YouTubeQuery(new URL(
>> "http://gdata.youtube.com/feeds/api/videos"));
>> // order results by the number of views (most
>> viewed first)
>> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
>> VideoFeed videoFeed;
>> Query.CategoryFilter categoryFilter1 = new
>> Query.CategoryFilter();
>> // this restricts to videos in the category of "Music".
>> categoryFilter1.addCategory(new Category(
>> YouTubeNamespace.CATEGORY_SCHEME,
>> "Music"));
>> // multiple filters mean "AND" in a category query
>> query.addCategoryFilter(categoryFilter1);
>> // query.addCategoryFilter(categoryFilter2);
>> for (String song : this.songs) {
>> query.setFullTextQuery(artist_name + " " +
>> song);
>> videoFeed = service.query(query,
>> VideoFeed.class);
>> // iterate over each videoEntry and fetch
>> comments and tags
>> this.fetchYoutubeCommentsAndTags(videoFeed,
>> service);
>> }
>> }
>> /**
>> * fetches all keywords and comments from the given video-feed.
>> * the tag-occurrences are counted.
>> * @param videoFeed the videoFeed to iterate over
>> * @param service the service to operate on
>> */
>> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
>> YouTubeService service) throws IOException,
>> ServiceException {
>> int oldVal;
>> // iterate over each videoEntry
>> CommentFeed commentFeed;
>> for (VideoEntry videoEntry : videoFeed.getEntries()) {
>> YouTubeMediaGroup mediaGroup =
>> videoEntry.getMediaGroup();
>> MediaKeywords keywords =
>> mediaGroup.getKeywords();
>> // fetch all keywords of the videoEntry
>> (and count the occurrences)
>> for (String keyword : keywords.getKeywords()) {
>> keyword =
>> Stuff.normalizeKeyword(keyword.toLowerCase());
>> if
>> (!youtubeTags.containsKey(keyword)) {
>> youtubeTags.put(keyword,
>> 1);// first occurrence
>> } else {
>> oldVal =
>> youtubeTags.get(keyword);
>> youtubeTags.put(keyword,
>> oldVal + 1);// tag already inserted
>> }
>> }
>> at the moment im only trying my program with 1 artist. for every
>> artist there are about 20 albums and 50 songs. (just to give you a
>> dimension...)
>> for getting the information for the artist itself and for the albums
>> there is another method pretty similar to the getYoutubeSongs() -
>> method
>> i hope someone can tell me where the problem is. i mean the error-msg
>> seems quite clear, but i cannot imagine that there is really no way to
>> realize what im planning to do...
>> im grateful for every help!
>> kind regards,
>> daniel
> thanks for the reply!
> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
> where should i put them and how long should the thread sleep ... i dont
> really get what exactly causes my problems....
The rate to fire requests to YouTube is too high. Try to lower it. I
am not sure, but perhaps setting the developer key and the client id
helps (http://code.google.com/apis/youtube/dashboard/).
Double the timeout when you receive the error. Lower the timeout a
tiny bit when you did not receive an error...
> On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller <daniel_thal...@gmx.at> wrote:
>> Jeff Fisher schrieb:
>>> Throw in some Thread.sleep() statements perhaps? :)
>>> Cheers,
>>> -Jeff
>>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
>>> <mailto:daniel_thal...@gmx.at>> wrote:
>>> hi people! (sorry for my bad english in advance .. :) )
>>> im new to this and i hope this is the right place to put my question
>>> to...
>>> im writing a java program, that tries to find similarities between
>>> artists based on occurrences of special words in the youtube-comments
>>> of a video.
>>> i have a list of songs and albums of every artist and based on that
>>> information i search for the corresponding videos and get the feeds
>>> for them to get the information that i need.
>>> here are two methods where i run into the trouble:
>>> System.out.println("... getting songs-infos from
>>> Youtube ...");
>>> YouTubeQuery query = new YouTubeQuery(new URL(
>>> "http://gdata.youtube.com/feeds/api/videos"));
>>> // order results by the number of views (most
>>> viewed first)
>>> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
>>> VideoFeed videoFeed;
>>> Query.CategoryFilter categoryFilter1 = new
>>> Query.CategoryFilter();
>>> // this restricts to videos in the category of "Music".
>>> categoryFilter1.addCategory(new Category(
>>> YouTubeNamespace.CATEGORY_SCHEME,
>>> "Music"));
>>> // multiple filters mean "AND" in a category query
>>> query.addCategoryFilter(categoryFilter1);
>>> // query.addCategoryFilter(categoryFilter2);
>>> for (String song : this.songs) {
>>> query.setFullTextQuery(artist_name + " " +
>>> song);
>>> videoFeed = service.query(query,
>>> VideoFeed.class);
>>> // iterate over each videoEntry and fetch
>>> comments and tags
>>> this.fetchYoutubeCommentsAndTags(videoFeed,
>>> service);
>>> }
>>> }
>>> /**
>>> * fetches all keywords and comments from the given video-feed.
>>> * the tag-occurrences are counted.
>>> * @param videoFeed the videoFeed to iterate over
>>> * @param service the service to operate on
>>> */
>>> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
>>> YouTubeService service) throws IOException,
>>> ServiceException {
>>> int oldVal;
>>> // iterate over each videoEntry
>>> CommentFeed commentFeed;
>>> for (VideoEntry videoEntry : videoFeed.getEntries()) {
>>> YouTubeMediaGroup mediaGroup =
>>> videoEntry.getMediaGroup();
>>> MediaKeywords keywords =
>>> mediaGroup.getKeywords();
>>> // fetch all keywords of the videoEntry
>>> (and count the occurrences)
>>> for (String keyword : keywords.getKeywords()) {
>>> keyword =
>>> Stuff.normalizeKeyword(keyword.toLowerCase());
>>> if
>>> (!youtubeTags.containsKey(keyword)) {
>>> youtubeTags.put(keyword,
>>> 1);// first occurrence
>>> } else {
>>> oldVal =
>>> youtubeTags.get(keyword);
>>> youtubeTags.put(keyword,
>>> oldVal + 1);// tag already inserted
>>> }
>>> }
>>> at the moment im only trying my program with 1 artist. for every
>>> artist there are about 20 albums and 50 songs. (just to give you a
>>> dimension...)
>>> for getting the information for the artist itself and for the albums
>>> there is another method pretty similar to the getYoutubeSongs() -
>>> method
>>> i hope someone can tell me where the problem is. i mean the error-msg
>>> seems quite clear, but i cannot imagine that there is really no way to
>>> realize what im planning to do...
>>> im grateful for every help!
>>> kind regards,
>>> daniel
>> thanks for the reply!
>> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
>> where should i put them and how long should the thread sleep ... i dont
>> really get what exactly causes my problems....
> The rate to fire requests to YouTube is too high. Try to lower it. I
> am not sure, but perhaps setting the developer key and the client id
> helps (http://code.google.com/apis/youtube/dashboard/).
> Double the timeout when you receive the error. Lower the timeout a
> tiny bit when you did not receive an error...
> Cheers
>> kind regards,
>> daniel
the developer key and the client id are set using the command:
YouTubeService service = new YouTubeService("xxx", "xxx");
the service-object is then passed to the methods as you can see in the example code i posted...
@rate of firing requests: what is the maximum rate that is allowed? i mean, i dont know if i have to wait some milliseconds, seconds, minutes, hours?!?
ahh, and 1 point i was wondering about: today the first time i ran the program, it ended without any error. (is there a cap for a whole day eventually? for example: 1000 requests per day --> in that case the thread.sleep() statements wouldnt help, right?(at least if i dont want my program to run the whole day :-) ) )
> On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller <daniel_thal...@gmx.at> wrote:
>> Jeff Fisher schrieb:
>>> Throw in some Thread.sleep() statements perhaps? :)
>>> Cheers,
>>> -Jeff
>>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
>>> <mailto:daniel_thal...@gmx.at>> wrote:
>>> hi people! (sorry for my bad english in advance .. :) )
>>> im new to this and i hope this is the right place to put my question
>>> to...
>>> im writing a java program, that tries to find similarities between
>>> artists based on occurrences of special words in the youtube-comments
>>> of a video.
>>> i have a list of songs and albums of every artist and based on that
>>> information i search for the corresponding videos and get the feeds
>>> for them to get the information that i need.
>>> here are two methods where i run into the trouble:
>>> System.out.println("... getting songs-infos from
>>> Youtube ...");
>>> YouTubeQuery query = new YouTubeQuery(new URL(
>>> "http://gdata.youtube.com/feeds/api/videos"));
>>> // order results by the number of views (most
>>> viewed first)
>>> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
>>> VideoFeed videoFeed;
>>> Query.CategoryFilter categoryFilter1 = new
>>> Query.CategoryFilter();
>>> // this restricts to videos in the category of "Music".
>>> categoryFilter1.addCategory(new Category(
>>> YouTubeNamespace.CATEGORY_SCHEME,
>>> "Music"));
>>> // multiple filters mean "AND" in a category query
>>> query.addCategoryFilter(categoryFilter1);
>>> // query.addCategoryFilter(categoryFilter2);
>>> for (String song : this.songs) {
>>> query.setFullTextQuery(artist_name + " " +
>>> song);
>>> videoFeed = service.query(query,
>>> VideoFeed.class);
>>> // iterate over each videoEntry and fetch
>>> comments and tags
>>> this.fetchYoutubeCommentsAndTags(videoFeed,
>>> service);
>>> }
>>> }
>>> /**
>>> * fetches all keywords and comments from the given video-feed.
>>> * the tag-occurrences are counted.
>>> * @param videoFeed the videoFeed to iterate over
>>> * @param service the service to operate on
>>> */
>>> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
>>> YouTubeService service) throws IOException,
>>> ServiceException {
>>> int oldVal;
>>> // iterate over each videoEntry
>>> CommentFeed commentFeed;
>>> for (VideoEntry videoEntry : videoFeed.getEntries()) {
>>> YouTubeMediaGroup mediaGroup =
>>> videoEntry.getMediaGroup();
>>> MediaKeywords keywords =
>>> mediaGroup.getKeywords();
>>> // fetch all keywords of the videoEntry
>>> (and count the occurrences)
>>> for (String keyword : keywords.getKeywords()) {
>>> keyword =
>>> Stuff.normalizeKeyword(keyword.toLowerCase());
>>> if
>>> (!youtubeTags.containsKey(keyword)) {
>>> youtubeTags.put(keyword,
>>> 1);// first occurrence
>>> } else {
>>> oldVal =
>>> youtubeTags.get(keyword);
>>> youtubeTags.put(keyword,
>>> oldVal + 1);// tag already inserted
>>> }
>>> }
>>> at the moment im only trying my program with 1 artist. for every
>>> artist there are about 20 albums and 50 songs. (just to give you a
>>> dimension...)
>>> for getting the information for the artist itself and for the albums
>>> there is another method pretty similar to the getYoutubeSongs() -
>>> method
>>> i hope someone can tell me where the problem is. i mean the error-msg
>>> seems quite clear, but i cannot imagine that there is really no way to
>>> realize what im planning to do...
>>> im grateful for every help!
>>> kind regards,
>>> daniel
>> thanks for the reply!
>> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
>> where should i put them and how long should the thread sleep ... i dont
>> really get what exactly causes my problems....
> The rate to fire requests to YouTube is too high. Try to lower it. I
> am not sure, but perhaps setting the developer key and the client id
> helps (http://code.google.com/apis/youtube/dashboard/).
> Double the timeout when you receive the error. Lower the timeout a
> tiny bit when you did not receive an error...
> Cheers
>> kind regards,
>> daniel
hmm.. now i added the thread.sleep() command like you suggested. i dont get the old error anymore, but i get a service-unavailable error in following line in the fetchYoutubeCommentsAndTags()-method
> Phot Sirch schrieb:
> > On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller <daniel_thal...@gmx.at>
> wrote:
> >> Jeff Fisher schrieb:
> >>> Throw in some Thread.sleep() statements perhaps? :)
> >>> Cheers,
> >>> -Jeff
> >>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
> >>> <mailto:daniel_thal...@gmx.at>> wrote:
> >>> hi people! (sorry for my bad english in advance .. :) )
> >>> im new to this and i hope this is the right place to put my
> question
> >>> to...
> >>> im writing a java program, that tries to find similarities between
> >>> artists based on occurrences of special words in the
> youtube-comments
> >>> of a video.
> >>> i have a list of songs and albums of every artist and based on that
> >>> information i search for the corresponding videos and get the feeds
> >>> for them to get the information that i need.
> >>> here are two methods where i run into the trouble:
> >>> System.out.println("... getting songs-infos from
> >>> Youtube ...");
> >>> YouTubeQuery query = new YouTubeQuery(new URL(
> >>> "http://gdata.youtube.com/feeds/api/videos"));
> >>> // order results by the number of views (most
> >>> viewed first)
> >>> query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT);
> >>> VideoFeed videoFeed;
> >>> Query.CategoryFilter categoryFilter1 = new
> >>> Query.CategoryFilter();
> >>> // this restricts to videos in the category of
> "Music".
> >>> categoryFilter1.addCategory(new Category(
> >>> YouTubeNamespace.CATEGORY_SCHEME,
> >>> "Music"));
> >>> // multiple filters mean "AND" in a category query
> >>> query.addCategoryFilter(categoryFilter1);
> >>> // query.addCategoryFilter(categoryFilter2);
> >>> for (String song : this.songs) {
> >>> query.setFullTextQuery(artist_name + " " +
> >>> song);
> >>> videoFeed = service.query(query,
> >>> VideoFeed.class);
> >>> // iterate over each videoEntry and fetch
> >>> comments and tags
> >>> this.fetchYoutubeCommentsAndTags(videoFeed,
> >>> service);
> >>> }
> >>> }
> >>> /**
> >>> * fetches all keywords and comments from the given
> video-feed.
> >>> * the tag-occurrences are counted.
> >>> * @param videoFeed the videoFeed to iterate over
> >>> * @param service the service to operate on
> >>> */
> >>> public void fetchYoutubeCommentsAndTags(VideoFeed videoFeed,
> >>> YouTubeService service) throws IOException,
> >>> ServiceException {
> >>> int oldVal;
> >>> at the moment im only trying my program with 1 artist. for every
> >>> artist there are about 20 albums and 50 songs. (just to give you a
> >>> dimension...)
> >>> for getting the information for the artist itself and for the
> albums
> >>> there is another method pretty similar to the getYoutubeSongs() -
> >>> method
> >>> i hope someone can tell me where the problem is. i mean the
> error-msg
> >>> seems quite clear, but i cannot imagine that there is really no way
> to
> >>> realize what im planning to do...
> >>> im grateful for every help!
> >>> kind regards,
> >>> daniel
> >> thanks for the reply!
> >> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
> >> where should i put them and how long should the thread sleep ... i dont
> >> really get what exactly causes my problems....
> > The rate to fire requests to YouTube is too high. Try to lower it. I
> > am not sure, but perhaps setting the developer key and the client id
> > helps (http://code.google.com/apis/youtube/dashboard/).
> > Double the timeout when you receive the error. Lower the timeout a
> > tiny bit when you did not receive an error...
> > Cheers
> >> kind regards,
> >> daniel
> hmm.. now i added the thread.sleep() command like you suggested. i dont
> get the old error anymore, but i get a service-unavailable error in
> following line in the fetchYoutubeCommentsAndTags()-method
> Service unavailable is usually a temporary service outage.
> On Tue, May 19, 2009 at 3:10 AM, Daniel Thaller <daniel_thal...@gmx.at > <mailto:daniel_thal...@gmx.at>> wrote:
> Phot Sirch schrieb:
> > On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller
> <daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>> wrote:
> >> Jeff Fisher schrieb:
> >>> Throw in some Thread.sleep() statements perhaps? :)
> >>> Cheers,
> >>> -Jeff
> >>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
> <mailto:daniel_thal...@gmx.at>
> >>> <mailto:daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>>>
> wrote:
> >>> hi people! (sorry for my bad english in advance .. :) )
> >>> im new to this and i hope this is the right place to put
> my question
> >>> to...
> >>> im writing a java program, that tries to find similarities
> between
> >>> artists based on occurrences of special words in the
> youtube-comments
> >>> of a video.
> >>> i have a list of songs and albums of every artist and
> based on that
> >>> information i search for the corresponding videos and get
> the feeds
> >>> for them to get the information that i need.
> >>> here are two methods where i run into the trouble:
> >>> YouTubeQuery query = new YouTubeQuery(new URL(
> >>> "http://gdata.youtube.com/feeds/api/videos"));
> >>> // order results by the number of views (most
> >>> viewed first)
> >>> /**
> >>> * fetches all keywords and comments from the given
> video-feed.
> >>> * the tag-occurrences are counted.
> >>> * @param videoFeed the videoFeed to iterate over
> >>> * @param service the service to operate on
> >>> */
> >>> public void fetchYoutubeCommentsAndTags(VideoFeed
> videoFeed,
> >>> YouTubeService service) throws
> IOException,
> >>> ServiceException {
> >>> int oldVal;
> >>> at the moment im only trying my program with 1 artist. for
> every
> >>> artist there are about 20 albums and 50 songs. (just to
> give you a
> >>> dimension...)
> >>> for getting the information for the artist itself and for
> the albums
> >>> there is another method pretty similar to the
> getYoutubeSongs() -
> >>> method
> >>> i hope someone can tell me where the problem is. i mean
> the error-msg
> >>> seems quite clear, but i cannot imagine that there is
> really no way to
> >>> realize what im planning to do...
> >>> im grateful for every help!
> >>> kind regards,
> >>> daniel
> >> thanks for the reply!
> >> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
> >> where should i put them and how long should the thread sleep
> ... i dont
> >> really get what exactly causes my problems....
> > The rate to fire requests to YouTube is too high. Try to lower it. I
> > am not sure, but perhaps setting the developer key and the client id
> > helps (http://code.google.com/apis/youtube/dashboard/).
> > Double the timeout when you receive the error. Lower the timeout a
> > tiny bit when you did not receive an error...
> > Cheers
> >> kind regards,
> >> daniel
> hmm.. now i added the thread.sleep() command like you suggested. i
> dont
> get the old error anymore, but i get a service-unavailable error in
> following line in the fetchYoutubeCommentsAndTags()-method
Not really. Maybe pray to the deity of your choice? :)
Seriously though, these are meant to be temporary and happen very rarely. We
don't ever plan on having service interruptions of no API service at all
(really!)
Cheers,
-Jeff
On Tue, May 19, 2009 at 11:47 PM, Daniel Thaller <daniel_thal...@gmx.at>wrote:
> Jeff Fisher schrieb:
> > Service unavailable is usually a temporary service outage.
> > On Tue, May 19, 2009 at 3:10 AM, Daniel Thaller <daniel_thal...@gmx.at
> > <mailto:daniel_thal...@gmx.at>> wrote:
> > Phot Sirch schrieb:
> > > On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller
> > <daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>> wrote:
> > >> Jeff Fisher schrieb:
> > >>> Throw in some Thread.sleep() statements perhaps? :)
> > >>> Cheers,
> > >>> -Jeff
> > >>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
> > <mailto:daniel_thal...@gmx.at>
> > >>> <mailto:daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>>>
> > wrote:
> > >>> hi people! (sorry for my bad english in advance .. :) )
> > >>> im new to this and i hope this is the right place to put
> > my question
> > >>> to...
> > >>> im writing a java program, that tries to find similarities
> > between
> > >>> artists based on occurrences of special words in the
> > youtube-comments
> > >>> of a video.
> > >>> i have a list of songs and albums of every artist and
> > based on that
> > >>> information i search for the corresponding videos and get
> > the feeds
> > >>> for them to get the information that i need.
> > >>> here are two methods where i run into the trouble:
> > >>> /**
> > >>> * fetches all keywords and comments from the given
> > video-feed.
> > >>> * the tag-occurrences are counted.
> > >>> * @param videoFeed the videoFeed to iterate over
> > >>> * @param service the service to operate on
> > >>> */
> > >>> public void fetchYoutubeCommentsAndTags(VideoFeed
> > videoFeed,
> > >>> YouTubeService service) throws
> > IOException,
> > >>> ServiceException {
> > >>> int oldVal;
> > >>> at the moment im only trying my program with 1 artist. for
> > every
> > >>> artist there are about 20 albums and 50 songs. (just to
> > give you a
> > >>> dimension...)
> > >>> for getting the information for the artist itself and for
> > the albums
> > >>> there is another method pretty similar to the
> > getYoutubeSongs() -
> > >>> method
> > >>> i hope someone can tell me where the problem is. i mean
> > the error-msg
> > >>> seems quite clear, but i cannot imagine that there is
> > really no way to
> > >>> realize what im planning to do...
> > >>> im grateful for every help!
> > >>> kind regards,
> > >>> daniel
> > >> thanks for the reply!
> > >> [quote]Throw in some Thread.sleep() statements perhaps? :)[/quote]
> > >> where should i put them and how long should the thread sleep
> > ... i dont
> > >> really get what exactly causes my problems....
> > > The rate to fire requests to YouTube is too high. Try to lower it.
> I
> > > am not sure, but perhaps setting the developer key and the client
> id
> > > helps (http://code.google.com/apis/youtube/dashboard/).
> > > Double the timeout when you receive the error. Lower the timeout a
> > > tiny bit when you did not receive an error...
> > > Cheers
> > >> kind regards,
> > >> daniel
> > hmm.. now i added the thread.sleep() command like you suggested. i
> > dont
> > get the old error anymore, but i get a service-unavailable error in
> > following line in the fetchYoutubeCommentsAndTags()-method
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
(HttpGDataRequest.java:533)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
(GoogleGDataRequest.java:562)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse
(HttpGDataRequest.java:481)
at com.google.gdata.client.http.HttpGDataRequest.execute
(HttpGDataRequest.java:460)
at com.google.gdata.client.http.GoogleGDataRequest.execute
(GoogleGDataRequest.java:534)
at com.google.gdata.client.Service.getFeed(Service.java:962)
at com.google.gdata.client.Service.getFeed(Service.java:819)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:
593)
at com.google.gdata.client.Service.getFeed(Service.java:838)
at compareTags.CompArtist.fetchYoutubeCommentsAndTags(CompArtist.java:
293)
at compareTags.CompArtist.getYoutubeSongs(CompArtist.java:221)
at compareTags.CompArtist.fetchData(CompArtist.java:334)
at compareTags.Analysis.main(Analysis.java:35)
--> i dont consider this rare... :P
On 21 Mai, 22:30, Jeff Fisher <jfis...@youtube.com> wrote:
> Not really. Maybe pray to the deity of your choice? :)
> Seriously though, these are meant to be temporary and happen very rarely. We
> don't ever plan on having service interruptions of no API service at all
> (really!)
> Cheers,
> -Jeff
> On Tue, May 19, 2009 at 11:47 PM, Daniel Thaller <daniel_thal...@gmx.at>wrote:
> > Jeff Fisher schrieb:
> > > Service unavailable is usually a temporary service outage.
> > > On Tue, May 19, 2009 at 3:10 AM, Daniel Thaller <daniel_thal...@gmx.at
> > > <mailto:daniel_thal...@gmx.at>> wrote:
> > > Phot Sirch schrieb:
> > > > On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller
> > > <daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>> wrote:
> > > >> Jeff Fisher schrieb:
> > > >>> Throw in some Thread.sleep() statements perhaps? :)
> > > >>> Cheers,
> > > >>> -Jeff
> > > >>> On Mon, May 18, 2009 at 7:20 AM, r3try <daniel_thal...@gmx.at
> > > <mailto:daniel_thal...@gmx.at>
> > > >>> <mailto:daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>>>
> > > wrote:
> > > >>> hi people! (sorry for my bad english in advance .. :) )
> > > >>> im new to this and i hope this is the right place to put
> > > my question
> > > >>> to...
> > > >>> im writing a java program, that tries to find similarities
> > > between
> > > >>> artists based on occurrences of special words in the
> > > youtube-comments
> > > >>> of a video.
> > > >>> i have a list of songs and albums of every artist and
> > > based on that
> > > >>> information i search for the corresponding videos and get
> > > the feeds
> > > >>> for them to get the information that i need.
> > > >>> here are two methods where i run into the trouble:
> > > >>> at the moment im only trying my program with 1 artist. for
> > > every
> > > >>> artist there are about 20 albums and 50 songs. (just to
> > > give you a
> > > >>> dimension...)
> > > >>> for getting the information for the artist itself and for
> > > the albums
> > > >>> there is another method pretty similar to the
Okay, but is this reproducible with a small bit of sample code and doing
only a few operations or is this like 3 exceptions in an hour when
performing hundreds of requests?
> at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
> (HttpGDataRequest.java:533)
> at
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
> (GoogleGDataRequest.java:562)
> at com.google.gdata.client.http.HttpGDataRequest.checkResponse
> (HttpGDataRequest.java:481)
> at com.google.gdata.client.http.HttpGDataRequest.execute
> (HttpGDataRequest.java:460)
> at com.google.gdata.client.http.GoogleGDataRequest.execute
> (GoogleGDataRequest.java:534)
> at com.google.gdata.client.Service.getFeed(Service.java:962)
> at com.google.gdata.client.Service.getFeed(Service.java:819)
> at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:
> 593)
> at com.google.gdata.client.Service.getFeed(Service.java:838)
> at
> compareTags.CompArtist.fetchYoutubeCommentsAndTags(CompArtist.java:
> 293)
> at compareTags.CompArtist.getYoutubeSongs(CompArtist.java:221)
> at compareTags.CompArtist.fetchData(CompArtist.java:334)
> at compareTags.Analysis.main(Analysis.java:35)
> --> i dont consider this rare... :P
> On 21 Mai, 22:30, Jeff Fisher <jfis...@youtube.com> wrote:
> > Not really. Maybe pray to the deity of your choice? :)
> > Seriously though, these are meant to be temporary and happen very rarely.
> We
> > don't ever plan on having service interruptions of no API service at all
> > (really!)
> > Cheers,
> > -Jeff
> > On Tue, May 19, 2009 at 11:47 PM, Daniel Thaller <daniel_thal...@gmx.at
> >wrote:
> > > Jeff Fisher schrieb:
> > > > Service unavailable is usually a temporary service outage.
> > > > On Tue, May 19, 2009 at 3:10 AM, Daniel Thaller <
> daniel_thal...@gmx.at
> > > > <mailto:daniel_thal...@gmx.at>> wrote:
> > > > Phot Sirch schrieb:
> > > > > On Tue, May 19, 2009 at 9:57 AM, Daniel Thaller
> > > > <daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at>> wrote:
> > > > >> Jeff Fisher schrieb:
> > > > >>> Throw in some Thread.sleep() statements perhaps? :)
> > > > >>> Cheers,
> > > > >>> -Jeff
> > > > >>> On Mon, May 18, 2009 at 7:20 AM, r3try <
> daniel_thal...@gmx.at
> > > > <mailto:daniel_thal...@gmx.at>
> > > > >>> <mailto:daniel_thal...@gmx.at <mailto:daniel_thal...@gmx.at
> > > > wrote:
> > > > >>> hi people! (sorry for my bad english in advance .. :) )
> > > > >>> im new to this and i hope this is the right place to put
> > > > my question
> > > > >>> to...
> > > > >>> im writing a java program, that tries to find
> similarities
> > > > between
> > > > >>> artists based on occurrences of special words in the
> > > > youtube-comments
> > > > >>> of a video.
> > > > >>> i have a list of songs and albums of every artist and
> > > > based on that
> > > > >>> information i search for the corresponding videos and get
> > > > the feeds
> > > > >>> for them to get the information that i need.
> > > > >>> here are two methods where i run into the trouble:
> > > > >>> at the moment im only trying my program with 1 artist.
> for
> > > > every
> > > > >>> artist there are about 20 albums and 50 songs. (just to
> > > > give you a
> > > > >>> dimension...)
> > > > >>> for getting the information for the artist itself and for
> > > > the albums
> > > > >>> there is another method pretty similar to the
> > > > getYoutubeSongs() -
> > > > >>> method
> > > > >>> i hope someone can tell me where the problem is. i mean
> > > > the error-msg
> > > > >>> seems quite clear, but i cannot imagine
> Okay, but is this reproducible with a small bit of sample code and doing
> only a few operations
--> semms to be random...
>or is this like 3 exceptions in an hour when
> performing hundreds of requests?
--> yes (but i was wondering that this happens so frequently...)
is there a possibility to find out if the service is available, and
only if it is available to start my request.. i mean to find out
before i send my request, so that i dont run into this error....?
If the error appears randomly, it may be difficult to foresee, right?
But the good part about errors that appear randomly is, that if you
try the same request a second time, it might work...
Depending on you application you can either queue it up again, do some
other stuff in the meantime, or if a user is waiting for the request
to succeed, retry with a increasing timeout several times (like 3
times). First wait 20 seconds, then 40 seconds, and it is still
failing 80 seconds.
On Sat, May 23, 2009 at 9:30 AM, r3try <daniel_thal...@gmx.at> wrote:
>> Okay, but is this reproducible with a small bit of sample code and doing
>> only a few operations
> --> semms to be random...
>>or is this like 3 exceptions in an hour when
>> performing hundreds of requests?
> --> yes (but i was wondering that this happens so frequently...)
> is there a possibility to find out if the service is available, and
> only if it is available to start my request.. i mean to find out
> before i send my request, so that i dont run into this error....?