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

2019-08-09 00:40发布

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.

标签: php html url vine
1条回答
Rolldiameter
2楼-- · 2019-08-09 01:09

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.

查看更多
登录 后发表回答