2017-07-21 69 views
0

我已經連接到tumblr與php,我有視頻代碼,但是當視頻是mp4並插入沒有重疊播放按鈕。我注意到,如果我採用獨特的視頻參考,並將其傳遞給iframe,它可以工作。tumblr:從視頻html字符串中檢索視頻ID

以下是從tumblr返回。我怎樣才能在輸出中得到數字'123988138584',這樣我就可以以不同的方式使用?我需要在一個循環中做到這一點,所以我不能搜索這個數字,我想我需要抓住源碼中第5個和第6個之間的數字。

<video id="embed-59724c3fde66d663835959" class="crt-video crt-skin-default" width="250" height="141" poster="https://31.media.tumblr.com/tumblr_nrfpgvIFCb1twbtyc_frame1.jpg" preload="none" muted="" data-crt-video="" data-crt-options="{&quot;autoheight&quot;:null,&quot;duration&quot;:17,&quot;hdUrl&quot;:&quot;https:\/\/clarestrand.tumblr.com\/video_file\/t:8tTSaNxZkkAOPCxNMgJHPw\/123988138584\/tumblr_nrfpgvIFCb1twbtyc\/720&quot;,&quot;filmstrip&quot;:{&quot;url&quot;:&quot;https:\/\/33.media.tumblr.com\/previews\/tumblr_nrfpgvIFCb1twbtyc_filmstrip.jpg&quot;,&quot;width&quot;:&quot;200&quot;,&quot;height&quot;:&quot;112&quot;}}" controls="controls"> 
    <source src="https://clarestrand.tumblr.com/video_file/t:8tTSaNxZkkAOPCxNMgJHPw/123988138584/tumblr_nrfpgvIFCb1twbtyc/480" type="video/mp4"> 
</video> 

我接受其他的想法。我需要在視頻上播放按鈕。

感謝

+0

http://php.net/preg_match,http://php.net/domdocument,或(可能)是兩者的結合。 – ceejayoz

回答

1

的preg_match會的方式

preg_match("/\/video_file\/t\:.*\/(.*)\/.*\/.*\//", "$html", $matches, null, 0); 

測試在:https://xrg.es/#1kiuxbb

+0

令人驚訝,我現在明白了 – gcooke75