Skip to content

Commit

Permalink
Added imgur, puush, and droplr embedding support
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwb65 committed Aug 9, 2012
1 parent 434424c commit 14af6f6
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Classes/Views/Channel View/TVCImageURLParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -206,4 +230,4 @@ + (NSString *)imageURLFromBase:(NSString *)url
return nil;
}

@end
@end

0 comments on commit 14af6f6

Please sign in to comment.