a guest Aug 17th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (NSString *)getFirstImage:(NSString *)html {
  2.     NSString *tempText = [[NSString alloc]initWithFormat:@""];
  3.     NSScanner *pageScanner = [NSScanner scannerWithString:html];
  4.     [pageScanner setCaseSensitive:NO];
  5.     [pageScanner setCharactersToBeSkipped:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  6.     [pageScanner scanUpToString:@"<img " intoString:nil];
  7.     [pageScanner scanString:@"<img " intoString:nil];
  8.     [pageScanner scanUpToString:@"src=\"" intoString:nil];
  9.     [pageScanner scanString:@"src=\"" intoString:nil];
  10.     [pageScanner scanUpToString:@"\"" intoString:&tempText];
  11.     return tempText;
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand