-
Notifications
You must be signed in to change notification settings - Fork 471
Fix 'No format stream map found' issue (421) #422
Conversation
…WithOptions() - fixes the issue of 'No format stream map found'
|
||
$options = ['curl' => []]; | ||
|
||
if ($this->options['use_ip'] !== false) { | ||
$options['curl'][CURLOPT_INTERFACE] = $this->options['use_ip']; | ||
} | ||
|
||
$video_info_url = 'https://www.youtube.com/get_video_info?&video_id=' . $input . '&asv=3&el=detailpage&hl=en_US'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the url would undo the improvements of #365.
//But just incase it doesn't, we can fallback to the old URL. | ||
if (strpos($response->getBody()->__toString(), 'status=fail') !== false) { | ||
$video_info_url = 'https://www.youtube.com/get_video_info?&video_id=' . $input . '&asv=3&el=detailpage&hl=en_US'; | ||
$request = $this->getHttpClient()->createFullRequest( | ||
'GET', | ||
$video_info_url | ||
); | ||
$response = $this->getHttpClient()->send($request, $options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fallback was introduced with #365. Why do you deleted it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fallback is falling back on the URL that is the only one actually working right now, therefore I commented out the old URL and substituted it with the new one and deleted the fallback. The benefit of getting age restricted videos is no longer there if no videos are working at the moment.
src/Provider/Youtube/VideoInfo.php
Outdated
* @param array $options | ||
* @param mixed $string | ||
* | ||
* @return VideoInfo | ||
*/ | ||
public static function createFromStringWithOptions($string, array $options) | ||
public static function createFromStringWithOptions($string, array $options, $video_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new 3rd parameter must either have a default value or the tests must be changed to reflect this change. All travis builds failed because of this.
https://travis-ci.org/jeckman/YouTube-Downloader/builds/600005207
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, new commit addresses this issue
src/Provider/Youtube/VideoInfo.php
Outdated
@@ -182,6 +182,9 @@ public static function createFromStringWithOptions($string, array $options) | |||
|
|||
parse_str($string, $video_info); | |||
|
|||
// $string may not contain video_id, so we append it manually | |||
$video_info['video_id'] = $video_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check if video_id isn't set already before we overwrite it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done inside the new commit
This PR would undo some improvements of #365 from @BenNottelling |
…it into only if absent from it
Please review changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Ping @jeckman
Example YouTube video: https://www.youtube.com/watch?v=kXYiU_JCYtU
It used to show 'No format stream map found' message, now it works fine as long as 'enable_youtube_decipher_signature' is set to true in config.php