Skip to content
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
1 change: 1 addition & 0 deletions RSSParser/RSSItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@property (strong,nonatomic) NSDate *pubDate;
@property (strong,nonatomic) NSString *author;
@property (strong,nonatomic) NSString *guid;
@property (strong,nonatomic) NSSet *categories;

-(NSArray *)imagesFromItemDescription;
-(NSArray *)imagesFromContent;
Expand Down
2 changes: 2 additions & 0 deletions RSSParser/RSSItem.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder
_pubDate = [aDecoder decodeObjectForKey:@"pubDate"];
_author = [aDecoder decodeObjectForKey:@"author"];
_guid = [aDecoder decodeObjectForKey:@"guid"];
_categories = [aDecoder decodeObjectForKey:@"categories"];
}
return self;
}
Expand All @@ -88,6 +89,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder
[aCoder encodeObject:self.pubDate forKey:@"pubDate"];
[aCoder encodeObject:self.author forKey:@"author"];
[aCoder encodeObject:self.guid forKey:@"guid"];
[aCoder encodeObject:self.categories forKey:@"categories"];
}

#pragma mark -
Expand Down
9 changes: 9 additions & 0 deletions RSSParser/RSSParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName names
[currentItem setAuthor:tmpString];
} else if ([elementName isEqualToString:@"guid"]) {
[currentItem setGuid:tmpString];
} else if ([elementName isEqualToString:@"category"]) {
NSMutableSet *mutableSet = [currentItem.categories mutableCopy];
if (!mutableSet) {
mutableSet = [NSMutableSet set];
}

NSString *string = [tmpString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[mutableSet addObject:string];
currentItem.categories = [mutableSet copy];
}

// sometimes the URL is inside enclosure element, not in link. Reference: http://www.w3schools.com/rss/rss_tag_enclosure.asp
Expand Down