3 Commits

Author SHA1 Message Date
relikd
e0dec3adf9 Change matching order 2020-12-18 10:59:08 +01:00
relikd
f7eb63bed9 update changelog and bump version 2020-12-18 10:43:13 +01:00
relikd
23f4f125db Support for yt /c/channel-name URLs 2020-12-18 10:37:36 +01:00
6 changed files with 32 additions and 8 deletions

View File

@@ -8,6 +8,11 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
## [Unreleased] ## [Unreleased]
## [1.1.3] 2020-12-18
### Fixed
- Recognize YouTube channel URLs in the format `/c/channel-name`
## [1.1.2] 2020-11-27 ## [1.1.2] 2020-11-27
### Fixed ### Fixed
- Fixes hidden color option for marking unread entries. Unread menu entries did use `colorStatusIconTint` instead of `colorUnreadIndicator` (thanks @tchek) - Fixes hidden color option for marking unread entries. Unread menu entries did use `colorStatusIconTint` instead of `colorUnreadIndicator` (thanks @tchek)
@@ -148,7 +153,8 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
Initial release Initial release
[Unreleased]: https://github.com/relikd/baRSS/compare/v1.1.2...HEAD [Unreleased]: https://github.com/relikd/baRSS/compare/v1.1.3...HEAD
[1.1.3]: https://github.com/relikd/baRSS/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/relikd/baRSS/compare/v1.1.1...v1.1.2 [1.1.2]: https://github.com/relikd/baRSS/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/relikd/baRSS/compare/v1.1.0...v1.1.1 [1.1.1]: https://github.com/relikd/baRSS/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/relikd/baRSS/compare/v1.0.2...v1.1.0 [1.1.0]: https://github.com/relikd/baRSS/compare/v1.0.2...v1.1.0

View File

@@ -180,7 +180,7 @@ This project uses a modified version of Brent Simmons' [RSXML](https://github.co
##### Trivia ##### Trivia
- Start of project: __July 19, 2018__ - Start of project: __July 19, 2018__
- Estimated development time: __1963h+__ - Estimated development time: __1965h+__
- First prototype used __feedparser python__ library - First prototype used __feedparser python__ library

View File

@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
// TODO: Make plugins extensible? community extensions. // TODO: Make plugins extensible? community extensions.
@interface YouTubePlugin : NSObject @interface YouTubePlugin : NSObject
+ (NSString*)feedURL:(NSURL*)url; + (NSString*)feedURL:(NSURL*)url data:(NSData*)html;
+ (NSString*)videoImage:(NSString*)videoid; + (NSString*)videoImage:(NSString*)videoid;
+ (NSString*)videoImageHQ:(NSString*)videoid; + (NSString*)videoImageHQ:(NSString*)videoid;
@end @end

View File

@@ -33,12 +33,13 @@
@return @c nil if @c url is not properly formatted, YouTube feed URL otherwise. @return @c nil if @c url is not properly formatted, YouTube feed URL otherwise.
*/ */
+ (NSString*)feedURL:(NSURL*)url { + (NSString*)feedURL:(NSURL*)url data:(NSData*)html {
if (![url.host hasSuffix:@"youtube.com"]) // 'youtu.be' & 'youtube-nocookie.com' will redirect if (![url.host hasSuffix:@"youtube.com"]) // 'youtu.be' & 'youtube-nocookie.com' will redirect
return nil; return nil;
// https://www.youtube.com/channel/[channel-id] // https://www.youtube.com/channel/[channel-id]
// https://www.youtube.com/user/[user-name] // https://www.youtube.com/user/[user-name]
// https://www.youtube.com/playlist?list=[playlist-id] // https://www.youtube.com/playlist?list=[playlist-id]
// https://www.youtube.com/c/[channel-name]
#if DEBUG && ENV_LOG_YOUTUBE #if DEBUG && ENV_LOG_YOUTUBE
printf("resolving YouTube url:\n"); printf("resolving YouTube url:\n");
printf(" ↳ %s\n", url.absoluteString.UTF8String); printf(" ↳ %s\n", url.absoluteString.UTF8String);
@@ -62,6 +63,23 @@
break; break;
} }
} }
} else if ([type isEqualToString:@"c"]) {
NSData *m_head = [@"<meta itemprop=\"channelId\" content=\"" dataUsingEncoding:NSUTF8StringEncoding];
NSRange tmp = [html rangeOfData:m_head options:0 range:NSMakeRange(0, html.length)];
if (tmp.location == NSNotFound) {
NSData *m_json = [@"\"channelId\":\"" dataUsingEncoding:NSUTF8StringEncoding];
tmp = [html rangeOfData:m_json options:0 range:NSMakeRange(0, html.length)];
}
NSUInteger start = tmp.location + tmp.length;
NSUInteger end = html.length - start;
if (end > 50) end = 50; // no need to search till the end
NSString *substr = [[NSString alloc] initWithData:[html subdataWithRange:NSMakeRange(start, end)] encoding:NSUTF8StringEncoding];
if (substr) {
NSUInteger to = [substr rangeOfString:@"\""].location;
if (to != NSNotFound) {
found = [ytBase stringByAppendingFormat:@"?channel_id=%@", [substr substringToIndex:to]];
}
}
} }
} }
#if DEBUG && ENV_LOG_YOUTUBE #if DEBUG && ENV_LOG_YOUTUBE

View File

@@ -178,7 +178,7 @@
} }
else if (!meta || meta.feedLinks.count == 0) { else if (!meta || meta.feedLinks.count == 0) {
if ([xml.url.host hasSuffix:@"youtube.com"]) if ([xml.url.host hasSuffix:@"youtube.com"])
feedURL = [YouTubePlugin feedURL:xml.url]; feedURL = [YouTubePlugin feedURL:xml.url data:xml.data];
if (feedURL.length == 0) if (feedURL.length == 0)
self.error = [NSError feedURLNotFound:xml.url]; self.error = [NSError feedURLNotFound:xml.url];
} }

View File

@@ -45,7 +45,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.1.2</string> <string>1.1.3</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
<array> <array>
<dict> <dict>
@@ -70,7 +70,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>14633</string> <string>14644</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.news</string> <string>public.app-category.news</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
@@ -83,7 +83,7 @@
<true/> <true/>
</dict> </dict>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 relikd. Public Domain.</string> <string>Copyright © 2020 relikd.</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>AppHook</string> <string>AppHook</string>
<key>UTImportedTypeDeclarations</key> <key>UTImportedTypeDeclarations</key>