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 751f191 commit 0fc0fa7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,14 @@ function parseVideos($videoString = null) {
'/\/\/(www\.)?twitch.tv\/videos\/([a-zA-Z0-9_-]+)$/', $link, $matches
);

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

$id = $matches[2];
return '//player.twitch.tv/?video=' . $id . '#';
}else if (strpos($link, 'twitch.tv') !== FALSE) {
Expand Down

0 comments on commit 0fc0fa7

Please sign in to comment.