Skip to content

Commit

Permalink
Fix problem detecting relevant info in media:group
Browse files Browse the repository at this point in the history
Specifications available at https://www.rssboard.org/media-rss
  • Loading branch information
barijaona committed Oct 27, 2024
1 parent 498937a commit 08378be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Vienna/Sources/Parsing/AtomFeed.m
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,13 @@ - (BOOL)initAtomFeed:(NSXMLElement *)atomElement

// Parse media group
if ([itemChildElement.prefix isEqualToString:self.mediaPrefix] && [articleItemTag isEqualToString:@"group"]) {
if ([newFeedItem.enclosure isEqualToString:@""]) {
if (!newFeedItem.enclosure || [newFeedItem.enclosure isEqualToString:@""]) {
// group's first enclosure
NSString *enclosureString = [NSString stringWithFormat:@"%@:content", self.mediaPrefix];
newFeedItem.enclosure =
([[itemChildElement elementsForName:enclosureString].firstObject attributeForName:@"url"]).stringValue;
}
if (!articleBody) {
if (!articleBody || [articleBody isEqualToString:@""]) {
// use enclosure description as a workaround for feed description
NSString *descriptionString = [NSString stringWithFormat:@"%@:description", self.mediaPrefix];
articleBody =
Expand Down
4 changes: 2 additions & 2 deletions Vienna/Sources/Parsing/RSSFeed.m
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@ - (BOOL)initRSSFeedItems:(NSXMLElement *)startElement

// Parse media group
if ([itemChildElement.prefix isEqualToString:self.mediaPrefix] && [articleItemTag isEqualToString:@"group"]) {
if ([newFeedItem.enclosure isEqualToString:@""]) {
if (!newFeedItem.enclosure || [newFeedItem.enclosure isEqualToString:@""]) {
// group's first enclosure
NSString *enclosureString = [NSString stringWithFormat:@"%@:content", self.mediaPrefix];
newFeedItem.enclosure =
([[itemChildElement elementsForName:enclosureString].firstObject attributeForName:@"url"]).stringValue;
}
if (!articleBody) {
if (!articleBody || [articleBody isEqualToString:@""]) {
// use enclosure description as a workaround for feed description
NSString *descriptionString = [NSString stringWithFormat:@"%@:description", self.mediaPrefix];
articleBody =
Expand Down

0 comments on commit 08378be

Please sign in to comment.