Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image thumbnail URL to rss feed parsing #104

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Classes/MWFeedItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
NSString *summary; // Description of item
NSString *content; // More detailed content (if available)
NSString *author; // Item author

NSString *imageURL; // Image URL
// Enclosures: Holds 1 or more item enclosures (i.e. podcasts, mp3. pdf, etc)
// - NSArray of NSDictionaries with the following keys:
// url: where the enclosure is located (NSString)
Expand All @@ -58,5 +58,5 @@
@property (nonatomic, copy) NSString *content;
@property (nonatomic, copy) NSString *author;
@property (nonatomic, copy) NSArray *enclosures;

@property (nonatomic, copy) NSString *imageURL;
@end
4 changes: 3 additions & 1 deletion Classes/MWFeedItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@implementation MWFeedItem

@synthesize identifier, title, link, date, updated, summary, content, author, enclosures;
@synthesize identifier, title, link, date, updated, summary, content, author, enclosures, imageURL;

#pragma mark NSObject

Expand All @@ -60,6 +60,7 @@ - (id)initWithCoder:(NSCoder *)decoder {
content = [decoder decodeObjectForKey:@"content"];
author = [decoder decodeObjectForKey:@"author"];
enclosures = [decoder decodeObjectForKey:@"enclosures"];
imageURL = [decoder decodeObjectForKey:@"imageURL"];
}
return self;
}
Expand All @@ -73,6 +74,7 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
if (summary) [encoder encodeObject:summary forKey:@"summary"];
if (content) [encoder encodeObject:content forKey:@"content"];
if (author) [encoder encodeObject:author forKey:@"author"];
if (imageURL) [encoder encodeObject:imageURL forKey:@"imageURL"];
if (enclosures) [encoder encodeObject:enclosures forKey:@"enclosures"];
}

Expand Down
3 changes: 3 additions & 0 deletions Classes/MWFeedParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
else if ([currentPath isEqualToString:@"/rss/channel/item/pubDate"]) { if (processedText.length > 0) item.date = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC822]; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/enclosure"]) { [self createEnclosureFromAttributes:currentElementAttributes andAddToItem:item]; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/dc:date"]) { if (processedText.length > 0) item.date = [NSDate dateFromInternetDateTimeString:processedText formatHint:DateFormatHintRFC3339]; processed = YES; }
else if ([currentPath isEqualToString:@"/rss/channel/item/media:thumbnail"]) {if ([self.currentElementAttributes objectForKey:@"url"])
item.imageURL = self.currentElementAttributes[@"url"];
processed = YES; }
}

// Info
Expand Down