function find_youtube_link($postId) { $videoId = get_youtube_link_id(get_post($postId)->post_content); if ($videoId) { $videoInfo = get_video_info($videoId); if ($videoInfo) { update_post_meta($postId, 'youtb_inf', $videoInfo); } else { $result = false; } } else { $result = false; } return $result; }
<?php include 'include/head.php'; ?> <?php $url = ''; $description = ''; $pngurl = ''; $cat = ''; if (isset($_GET['id'])) { $videoinfo = get_video_info($_GET['id']); $url = $videoinfo['url']; $description = $videoinfo['description']; $bigimage = $videoinfo['bigimage']; } else { die('没有指定播放的视频!'); } ?> <div class="video-center"> <div id="videoRight" class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title">相关视频</h4> </div> <div class="panel-body"> <?php $cat = get_cat_info($_GET['id']); for ($i = 0; $i < count($cat); $i++) { echo '<a title="' . $cat[$i]['title'] . '" href="' . $cat[$i]['url'] . '"><img class="relate-video" src="' . $cat[$i]['smallimage'] . '"/></a>';
function get_video_image($id, $flag) { //根据id,flag获得视频的大截图或者小截图 $videoinfo = get_video_info($id); echo $videoinfo[$flag]; }
<input name="url" type="text" class="form-control" placeholder="https://www.youtube.com/watch?v=d6kZ90_0eKc"> </div> <div class="col-sm-2"> <button type="submit" class="btn btn-primary">View</button> </div> </form> </div> <br /> <?php if (!empty($_REQUEST['url'])) { ?> <?php $video_info = get_video_info(get_video_id($_REQUEST['url'])); ?> <?php $fmt_list = explode(',', $video_info['fmt_list']); ?> <?php $dashmpd = new SimpleXMLElement(fetch($video_info['dashmpd'])); ?> <div class="row"> <div class="col-sm-12"> <h2><a href="https://www.youtube.com/watch?v=<?php e($video_info['video_id']); ?> "><?php