How to get thumbnails from any URL in iOS?

Viewed 3032

In both chat apps, social apps have a feature, when we paste a link on text view it's giving us a thumbnail from that url, enter image description here

Is this possible to do in an iOS app. If it is how may I do this?

5 Answers

Here is the best solution I used and I get the good results.

Source code: https://github.com/keshiim/WBGLinkPreview

Cocoapod Name: pod "WBGLinkPreview"

I used code inside my class like:

#import <WBGLinkPreview/WBGLinkPreview.h>

@interface ViewController ()
 {
     WBGLinkPreview *urlPreview;
 }
@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
urlPreview = [[WBGLinkPreview alloc] init];
[urlPreview previewWithText:@"https://www.youtube.com/watch?v=HHq_ChsWtb0"
                  onSuccess:^(NSDictionary *result) {
                      NSLog(@"Final Output:: %@", result);
                  } onError:^(WBGPreviewError *error) {
                     NSLog(@"%@", error.description);
                  }];
}
Related