Closed marktgodfrey closed 6 years ago
Same as @darkForestCat, moved all lib. files into my project for resolving it. :-) Thanks for everyone who joint this discussion and shared information.
Works!! 👍
Some changes are still needed for this PR. The latest version of youtube-dl downloads this video fine: https://www.youtube.com/watch?v=MxM7dko6_rw. However, this library is still experiencing issues. I believe the regex needs to be updated. @marktgodfrey can you take a look at: https://github.com/rg3/youtube-dl/commit/9a47fa35dd9dd2d53f4d3f088811ea29295991e5#diff-bd8242a0122c5207531954b67e6e51f0
@SoneeJohn Hi , SoneeJohn , How to use that change? Could you kindly to tell me.Thank you very very much.
@oososo this isn't working at the moment. Working on a fix now
@oososo this isn't working at the moment. Working on a fix now
Thank you . I will waiting online until you fix that.
I have changed this commit to the following and it works https://github.com/positive-grid/XCDYouTubeKit/commit/121bd5411c3eb2931f4902be5113da28e43e5b55
"signatureResults.count" may not zero, so do merge array instead.
Try this:
NSString* pattern = @"[\"']signature[\"']\\s*,\\s*([^\\(]+)"; NSRegularExpression *signatureRegularExpression = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:NULL]; NSArray<NSTextCheckingResult *> *signatureResults = [signatureRegularExpression matchesInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)]; pattern = @"(\\w+)\\s*=\\s*function\\((\\w+)\\).\\s*\\2=\\s*\\2\\.split\\(\"\"\\)\\s*;"; signatureRegularExpression = [NSRegularExpression regularExpressionWithPattern: pattern options:NSRegularExpressionCaseInsensitive error:NULL]; // signatureResults.count may not zero, so do merge array instead. NSArray<NSTextCheckingResult *> *otherResult = [signatureRegularExpression matchesInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)]; signatureResults = [signatureResults arrayByAddingObjectsFromArray:otherResult];
Here is my solution. Works fine my me :-)
NSArray<NSString *>*patterns = @[@"/.sig\\|\\|([[a-zA-Z0-9$]+)\\(", @"yt\\.akamaized\\.net/\\)\\s*\\|\\|\\s*.*?\\s*c\\s*&&d.set\\([^,]+\\s*,\\s*(?<sig>[a-zA-Z0-9$]+)", @"\\bcs*&&\\s*d\\.set\\([^,]+\\s*,\\s*([a-zA-Z0-9$]+)\\C"];
NSRegularExpression *signatureRegularExpression = nil;
NSArray<NSTextCheckingResult *> *signatureResults = nil;
for (NSString *pattern in patterns) {
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern options:NSRegularExpressionCaseInsensitive error:NULL];
NSArray<NSTextCheckingResult *> *regexResults = [regex matchesInString:script options:(NSMatchingOptions)0 range:NSMakeRange(0, script.length)];
if (regexResults.count != 0)
{
signatureRegularExpression = regex;
signatureResults = regexResults;
break;
}
}
@shiningjason @SoneeJohn
Thank you very much. I try your code, it work now.
I think I came up with a solution see #390
Yes. It work.
发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用
发件人: Soneé John notifications@github.com 发送时间: Friday, September 14, 2018 1:44:38 PM 收件人: 0xced/XCDYouTubeKit 抄送: oososo; Mention 主题: Re: [0xced/XCDYouTubeKit] add fallback for signature function regex (#383)
I think I came up with a solution see #390https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0xced%2FXCDYouTubeKit%2Fpull%2F390&data=02%7C01%7C%7Caee1955d80e24d24dd3008d61a05295c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636725006793090354&sdata=7x06BggM8JJk%2Fumd%2FACvnYXgQai0zjdmT3ga01Ng2%2Bw%3D&reserved=0
― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2F0xced%2FXCDYouTubeKit%2Fpull%2F383%23issuecomment-421237645&data=02%7C01%7C%7Caee1955d80e24d24dd3008d61a05295c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636725006793090354&sdata=20qBWl7T%2Fz5V%2FRN7cI%2FciSnI9yo%2BzQpFl8d3fnRe3pk%3D&reserved=0, or mute the threadhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAM1lxDHm3zq0ZaWgLJhV4UhFGMjxZI5Fks5ua0JGgaJpZM4WfcEP&data=02%7C01%7C%7Caee1955d80e24d24dd3008d61a05295c%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636725006793090354&sdata=ix6qDhb5Q3IrDEyYMiSKiyUt9vS2uQ%2FFpKlQxFKyYHE%3D&reserved=0.
Works!! 👍
No Actually it doesn't work for all videos. I am facing "No signature function in player script" exceptions. I believe the regex need to be fixed.
@alkait Can you let me know which videos you noticed that error with?
seems like @SoneeJohn has it with #390
Fix #382 by adding fallback for regex parsing the javascript signature function