diff --git a/baRSS/Feed Import/Download3rdParty.h b/baRSS/Feed Import/Download3rdParty.h
index 518aaa8..28e3b34 100644
--- a/baRSS/Feed Import/Download3rdParty.h
+++ b/baRSS/Feed Import/Download3rdParty.h
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
// TODO: Make plugins extensible? community extensions.
@interface YouTubePlugin : NSObject
-+ (NSString*)feedURL:(NSURL*)url;
++ (NSString*)feedURL:(NSURL*)url data:(NSData*)html;
+ (NSString*)videoImage:(NSString*)videoid;
+ (NSString*)videoImageHQ:(NSString*)videoid;
@end
diff --git a/baRSS/Feed Import/Download3rdParty.m b/baRSS/Feed Import/Download3rdParty.m
index 8614af5..bf45682 100644
--- a/baRSS/Feed Import/Download3rdParty.m
+++ b/baRSS/Feed Import/Download3rdParty.m
@@ -33,12 +33,13 @@
@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
return nil;
// https://www.youtube.com/channel/[channel-id]
// https://www.youtube.com/user/[user-name]
// https://www.youtube.com/playlist?list=[playlist-id]
+ // https://www.youtube.com/c/[channel-name]
#if DEBUG && ENV_LOG_YOUTUBE
printf("resolving YouTube url:\n");
printf(" ↳ %s\n", url.absoluteString.UTF8String);
@@ -62,6 +63,23 @@
break;
}
}
+ } else if ([type isEqualToString:@"c"]) {
+ NSData *m_json = [@"\"channelId\":\"" dataUsingEncoding:NSUTF8StringEncoding];
+ NSRange tmp = [html rangeOfData:m_json options:0 range:NSMakeRange(0, html.length)];
+ if (tmp.location == NSNotFound) {
+ NSData *m_head = [@" 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
diff --git a/baRSS/Feed Import/FeedDownload.m b/baRSS/Feed Import/FeedDownload.m
index 64aeb86..b9f728e 100644
--- a/baRSS/Feed Import/FeedDownload.m
+++ b/baRSS/Feed Import/FeedDownload.m
@@ -178,7 +178,7 @@
}
else if (!meta || meta.feedLinks.count == 0) {
if ([xml.url.host hasSuffix:@"youtube.com"])
- feedURL = [YouTubePlugin feedURL:xml.url];
+ feedURL = [YouTubePlugin feedURL:xml.url data:xml.data];
if (feedURL.length == 0)
self.error = [NSError feedURLNotFound:xml.url];
}
diff --git a/baRSS/Info.plist b/baRSS/Info.plist
index c5708a0..3b9261f 100644
--- a/baRSS/Info.plist
+++ b/baRSS/Info.plist
@@ -70,7 +70,7 @@
CFBundleVersion
- 14633
+ 14642
LSApplicationCategoryType
public.app-category.news
LSMinimumSystemVersion