保存视频而不是流媒体

时间:2019-03-31 05:39:33

标签: php youtube-data-api

我正在通过YouTube API从YouTube获取视频,所有视频都是流式传输,而不是在单击视频链接时下载。单击生成的视频格式时如何强制下载?

Download URL

<?php $this->start('content');?>
<?php if (count($streamLinks) > 0) :?>
    <h3 class="heading"><span>Download Links</span></h3>
    <div class="alert alert-success">
        Here are the download links for <b><?=$videoInfo['title']?></b>
    </div>
    <div class="ads ads-download">
        <?php adcode_download(); ?>
    </div>
    <ul class="download-links">
        <?php foreach ($streamLinks as $v) : ?>
            <li>
                <a href="<?=$v->getLink()?>">
                    <?=strtoupper($v->getExtension())?> -
                    <?php if ($v->isAudioOnly()) : ?>
                        <?=$v->getAudioBitrate()?>
                        <span style="color:orange"> [AUDIO ONLY]</span>
                    <?php elseif ($v->isVideoOnly()) : ?>
                        <?=$v->getHeight()?>P
                        <span style="color:blue"> [VIDEO ONLY]</span>
                    <?php elseif ($v->hasBoth()) : ?>
                        <?=$v->getHeight()?>P
                        <span style="color:green"> [FULL VIDEO]</span>
                    <?php endif;?>
                    - <?php echo $v->getSize(); ?>
                </a>
            </li>
        <?php endforeach; ?>

0 个答案:

没有答案