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

added image url support for rss feed #91

Open
wants to merge 1 commit 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
3 changes: 2 additions & 1 deletion Classes/MWFeedItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
NSString *summary; // Description of item
NSString *content; // More detailed content (if available)
NSString *author; // Item author
NSString *image; // image for the feed

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

@property (nonatomic, copy) NSString *image;
@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, image;

#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"];
image = [decoder decodeObjectForKey:@"image"];
}
return self;
}
Expand All @@ -74,6 +75,7 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
if (content) [encoder encodeObject:content forKey:@"content"];
if (author) [encoder encodeObject:author forKey:@"author"];
if (enclosures) [encoder encodeObject:enclosures forKey:@"enclosures"];
if (image) [encoder encodeObject:image forKey:@"image"];
}

@end
1 change: 1 addition & 0 deletions Classes/MWFeedParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ - (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/image/url"]) { if (processedText.length > 0) item.image = processedText; processed = YES; }
}

// Info
Expand Down