Skip to content

Commit

Permalink
Fix twitch embed #505
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel authored and daniel committed Mar 22, 2018
1 parent cd59a0d commit 751f191
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,23 @@ function parseVideos($videoString = null) {

$id = $matches[2];
return '//streamable.com/s/' . $id;
} else if (strpos($link, 'twitch.tv') !== FALSE) {
} else if (strpos($link, 'twitch.tv/videos') !== FALSE) {
//extract the ID
preg_match(
'/\/\/(www\.)?twitch.tv\/([a-zA-Z0-9_-]+)$/', $link, $matches
'/\/\/(www\.)?twitch.tv\/videos\/([a-zA-Z0-9_-]+)$/', $link, $matches
);

$id = $matches[2];
return '//player.twitch.tv/?channel=' . $id . '#';
} else if (strpos($link, 'twitch.tv/videos') !== FALSE) {
return '//player.twitch.tv/?video=' . $id . '#';
}else if (strpos($link, 'twitch.tv') !== FALSE) {
//extract the ID
preg_match(
'/\/\/(www\.)?twitch.tv\/videos\/([a-zA-Z0-9_-]+)$/', $link, $matches
'/\/\/(www\.)?twitch.tv\/([a-zA-Z0-9_-]+)$/', $link, $matches
);

$id = $matches[2];
return '//player.twitch.tv/?video=' . $id . '#';
} else if (strpos($link, '/video/') !== FALSE) {
return '//player.twitch.tv/?channel=' . $id . '#';
} else if (strpos($link, '/video/') !== FALSE) {
//extract the ID
preg_match(
'/(http.+)\/video\/([a-zA-Z0-9_-]+)($|\/)/i', $link, $matches
Expand Down

0 comments on commit 751f191

Please sign in to comment.