How to get Youtube Thumbnails
Solution 1
Using the listed RSS feed:
You'll see links that include:
LKk6SvGmJj4
Previous episode: http://youtu.be/LKk6SvGmJj4 http://gdata.youtube.com/feeds/mobile/videos/LKk6SvGmJj4
That's the youtube ID.
Take that ID and use it with a straight image tag.
http://img.youtube.com/vi/LKk6SvGmJj4/0.jpg
http://img.youtube.com/vi/LKk6SvGmJj4/1.jpg
Use those images to populate your tables. Personally, I use Afnetworking's UIImageView category.
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[imageView setImageWithURL:[NSURL URLWithString:@"http://img.youtube.com/vi/LKk6SvGmJj4/1.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
Solution 2
I have used UIImageView+AFNetworking
category to load image to an UIImageView
. UIImageView+AFNetworking
NSString * youtubeID = @"TJkmc8-eyvE";
NSURL *youtubeURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://img.youtube.com/vi/%@/0.jpg",youtubeId];
[imageView setImageWithURL:youtubeURL] placeholderImage:[UIImage imageNamed:@"placeHolderImage"]];
Related videos on Youtube
RafeeJ
Updated on September 15, 2022Comments
-
RafeeJ over 1 year
I have made an RSS reader app in Xcode, which gets it's information from a YouTube channel. How can I get the thumbails from the videos?
I am able to use this link: http://gdata.youtube.com/feeds/mobile/users/HaatFilms/uploads?alt=rss
To get the uploads text, but what would I use to get the thumbnail for each specific video?
-
RafeeJ over 10 yearsSorry, I have been busy, When I Tried it.. It didn't work. Am I supposed to add something else other than the stated code above?
-
Ayush over 10 yearsyeah you need to add afnetworking to load images asynchronous in you app. What error you are getting