Get .mp4 source and poster image from Vine Id (PHP)

爱⌒轻易说出口 提交于 2019-12-11 06:31:08

问题


How to get video.mp4 from vine url?

Example:

from https://vine.co/v/hnVVW2uQ1Z9

I need http://.../*.mp4 and http://.../*.jpg

Script what I need use this page vinebed.com

(In PHP)

Thanks much.


回答1:


It's very simple. if you check the source of a vine video from vine.co you'll see the meta tags. and you should see twitter:player:stream. By using php you can extract that information specifically and use it like a variable.

<?php
function vine( $id )
{
        $vine = file_get_contents("http://vine.co/v/{$id}");
        preg_match('/property="twitter:player:stream" content="(.*?)"/', $vine, $matches);
        $url = $_SERVER['REQUEST_URI'];
        return ($matches[1]) ? $matches[1] : false;

}
?>

And to set an $id you will need to create a function that will either A) Automatically read a vine video id by url and you can display it like this <?php echo vine('bv5ZeQjY35'); ?> or B) Just set a vine video id and display as is.

Hope this helps as it's worked for me just fine.



来源:https://stackoverflow.com/questions/18943165/get-mp4-source-and-poster-image-from-vine-id-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!