从Vine Id(PHP)获取.mp4来源和海报图片

时间:2022-02-22 09:45:13

How to get video.mp4 from vine url?

如何从藤蔓网站获取video.mp4?

Example:

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

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

我需要http://.../*.mp4和http://.../*.jpg

Script what I need use this page vinebed.com

脚本我需要使用此页面vinebed.com

(In PHP)

Thanks much.

1 个解决方案

#1


0  

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.

这很简单。如果你从vine.co查看藤蔓视频的来源,你会看到meta标签。你应该看到twitter:player:stream。通过使用php,您可以专门提取该信息,并将其用作变量。

<?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.

要设置一个$ id,你需要创建一个函数,以便A)通过url自动读取藤蔓视频id,你可以像这样显示它? 或B)只需设置藤蔓视频ID并按原样显示。

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

希望这有帮助,因为它对我很有用。

#1


0  

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.

这很简单。如果你从vine.co查看藤蔓视频的来源,你会看到meta标签。你应该看到twitter:player:stream。通过使用php,您可以专门提取该信息,并将其用作变量。

<?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.

要设置一个$ id,你需要创建一个函数,以便A)通过url自动读取藤蔓视频id,你可以像这样显示它? 或B)只需设置藤蔓视频ID并按原样显示。

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

希望这有帮助,因为它对我很有用。