网址在PHP中更改

时间:2015-01-21 10:36:00

标签: php youtube

Aoa每个人都使用youtube下载主脚本。在getvideo文件中,直接链接以此格式显示

http://r8---sn-a5mekm7l.googlevideo.com/videoplayback?signature=80A7B5CE3362C4896F566DA76A8520371D66A2BD.52B2941D336128059CD0A6165A543BDBAFB3CCDC&pl=24&mime=video%2F3gpp&ip=162.213.195.126&ipbits=0&nh=EAU&mm=35&fexp=900718%2C905653%2C907263%2C927622%2C932320%2C936102%2C9405427%2C9406355%2C941004%2C943917%2C947209%2C947225%2C948124%2C948703%2C951500%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701%2C960900&key=yt5&id=o-AKYJ4H87WlzlVTjFQTbKG2LN6NlZN36MxrlhmNQX4_cP&expire=1421857851&sparams=dur%2Cid%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cnh%2Cpl%2Csource%2Cupn%2Cexpire&upn=G37MNKZ4yl4&itag=17&ms=pm&sver=3&mt=1421832271&mv=s&dur=5973.426&source=youtube

但我希望采用这种格式

https://r5---sn-q4f7sn7l.c.docs.google.com/videoplayback?signature=80A7B5CE3362C4896F566DA76A8520371D66A2BD.52B2941D336128059CD0A6165A543BDBAFB3CCDC&pl=24&mime=video%2F3gpp&ip=162.213.195.126&ipbits=0&nh=EAU&mm=35&fexp=900718%2C905653%2C907263%2C927622%2C932320%2C936102%2C9405427%2C9406355%2C941004%2C943917%2C947209%2C947225%2C948124%2C948703%2C951500%2C952302%2C952605%2C952901%2C955301%2C957103%2C957105%2C957201%2C959701%2C960900&key=yt5&id=o-AKYJ4H87WlzlVTjFQTbKG2LN6NlZN36MxrlhmNQX4_cP&expire=1421857851&sparams=dur%2Cid%2Cip%2Cipbits%2Citag%2Cmime%2Cmm%2Cms%2Cmv%2Cnh%2Cpl%2Csource%2Cupn%2Cexpire&upn=G37MNKZ4yl4&itag=17&ms=pm&sver=3&mt=1421832271&mv=s&dur=5973.426&source=youtube

我不擅长php。

提前致谢

1 个答案:

答案 0 :(得分:0)

如果所有视频网址都有您要替换的相同初始字符串,则可以将http://r8---sn-a5mekm7l.googlevideo.com/替换为https://r5---sn-q4f7sn7l.c.docs.google.com/

这是代码

<?php   
$url = str_replace("http://r8---sn-a5mekm7l.googlevideo.com/", 
     "https://r5---sn-q4f7sn7l.c.docs.google.com/", $url);

 echo $url
?>