From 14af6f6a1cd81c0c7f2529c3177e4bee6b65fc49 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 8 Aug 2012 23:15:46 -0400 Subject: [PATCH] Added imgur, puush, and droplr embedding support --- .../Views/Channel View/TVCImageURLParser.m | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Classes/Views/Channel View/TVCImageURLParser.m b/Classes/Views/Channel View/TVCImageURLParser.m index e7877af158..8c4b60dc80 100755 --- a/Classes/Views/Channel View/TVCImageURLParser.m +++ b/Classes/Views/Channel View/TVCImageURLParser.m @@ -132,6 +132,30 @@ + (NSString *)imageURLFromBase:(NSString *)url return [NSString stringWithFormat:@"http://img.f.hatena.ne.jp/images/fotolife/%@/%@/%@/%@.jpg", userIdHead, userId, photoIdHead, photoId]; } } + } else if ([host isEqualToString:@"puu.sh"]) { + if (NSObjectIsNotEmpty(path)) { + NSString *s = [path safeSubstringFromIndex:1]; + + if ([s isAlphaNumOnly]) { + return [NSString stringWithFormat:@"http://puu.sh/%@.jpg", s]; + } + } + } else if ([host hasSuffix:@"imgur.com"]) { + if ([path hasPrefix:@"/gallery/"]) { + NSString *s = [path safeSubstringFromIndex:9]; + + if ([s isAlphaNumOnly]) { + return [NSString stringWithFormat:@"http://i.imgur.com/%@.png", s]; + } + } + } else if ([host hasSuffix:@"d.pr"]) { + if ([path hasPrefix:@"/i/"]) { + NSString *s = [path safeSubstringFromIndex:3]; + + if ([s isAlphaNumOnly]) { + return [NSString stringWithFormat:@"http://d.pr/i/%@.png", s]; + } + } } else if ([host hasSuffix:@"youtube.com"] || [host isEqualToString:@"youtu.be"]) { NSString *vid = nil; @@ -206,4 +230,4 @@ + (NSString *)imageURLFromBase:(NSString *)url return nil; } -@end \ No newline at end of file +@end