我找到了一个YouTube视频下载链接生成器...我的脚本是http://www.paylash.biz/admin/youtube/index.php?id=[YOUTUBE ID] 例如:http://www.paylash.biz/admin/youtube/index.php?id=cKWqawoJPnw 但它会给我:
Array
(
[0] => Array
(
[ext] => 3gp
[type] => Medium Quality - 176x144
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&algorithm=throttle-factor&burst=40&expire=1367365132&mv=u&sver=3&mt=1367342103&ipbits=8&ms=au&gcr=us&source=youtube&key=yt1&factor=1.25&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&id=70a5aa6b0a093e7c&newshard=yes&itag=17&signature=8864B62808466461882F04386057218EABF28F.81B02252560BDAB893AE6C55753D64D30DF3BAD0
)
[1] => Array
(
[ext] => 3gp
[type] => High Quality - 320x240
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&algorithm=throttle-factor&burst=40&expire=1367365132&mv=u&sver=3&mt=1367342103&ipbits=8&ms=au&gcr=us&source=youtube&key=yt1&factor=1.25&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&id=70a5aa6b0a093e7c&newshard=yes&itag=36&signature=6B94E19AE88E2E1FBE8CFE3A57CFF3EC3D68CE00.5399A38CA9B8F3302E0298F180CBEEA4D8810CAF
)
[2] => Array
(
[ext] => flv
[type] => Low Quality - 400x226
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&algorithm=throttle-factor&burst=40&expire=1367365132&mv=u&sver=3&mt=1367342103&ipbits=8&ms=au&gcr=us&source=youtube&key=yt1&factor=1.25&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&id=70a5aa6b0a093e7c&newshard=yes&itag=5&signature=681047019412022702DC977F6EAA3D8728A8F8C2.49267286178E66D24ED370C7F6C895E47C85F18B
)
[3] => Array
(
[ext] => flv
[type] => Medium Quality - 640x360
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&algorithm=throttle-factor&burst=40&expire=1367365132&mv=u&sver=3&mt=1367342103&ipbits=8&ms=au&gcr=us&source=youtube&key=yt1&factor=1.25&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&id=70a5aa6b0a093e7c&newshard=yes&itag=34&signature=4B7A96C7F0E5FA796B8D1429382041D518CB1639.B9BF0A636366448189A9A297582F48FF1C347871
)
[4] => Array
(
[ext] => flv
[type] => High Quality - 854x480
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&algorithm=throttle-factor&burst=40&expire=1367365132&mv=u&sver=3&mt=1367342103&ipbits=8&ms=au&gcr=us&source=youtube&key=yt1&factor=1.25&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&id=70a5aa6b0a093e7c&newshard=yes&itag=35&signature=CBA74C27EA4442E2A170218DE750D7129A6CF767.1D4EA626FBDEE5340523606A9AD811E26D8E264B
)
[5] => Array
(
[ext] => webm
[type] => Low Quality - 640x360
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&mt=1367342103&itag=43&expire=1367365132&mv=u&ipbits=8&sver=3&ms=au&gcr=us&ratebypass=yes&source=youtube&key=yt1&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&newshard=yes&id=70a5aa6b0a093e7c&signature=4B0E84BF1BBF632D81CFCC4A615CF31A4F4D9FB3.43A54E50CC78A26DFA4C22154C9E2FB999376CDC
)
[6] => Array
(
[ext] => webm
[type] => Medium Quality - 854x480
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&mt=1367342103&itag=44&expire=1367365132&mv=u&ipbits=8&sver=3&ms=au&gcr=us&ratebypass=yes&source=youtube&key=yt1&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&newshard=yes&id=70a5aa6b0a093e7c&signature=6C5E15D7A7AD84AB86C24655AF404348B2FC28AA.6645A6127C5FBC1923CB6E0A3EBAFC72A92B769F
)
[7] => Array
(
[ext] => mp4
[type] => Medium Quality - 480x360
[url] => http://r8---sn-mv-q4fl.c.youtube.com/videoplayback?sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=904825%2C916807%2C929202%2C916612%2C932000%2C932004%2C906383%2C906387%2C904479%2C904482%2C902000%2C901208%2C929903%2C925714%2C929119%2C931202%2C900821%2C900823%2C912518%2C911416%2C904476%2C908529%2C904830%2C930807%2C919373%2C906836%2C929602%2C930101%2C900824%2C912711%2C910075&upn=2VY3aGvOZVE&ip=184.173.107.5&mt=1367342103&itag=18&expire=1367365132&mv=u&ipbits=8&sver=3&ms=au&gcr=us&ratebypass=yes&source=youtube&key=yt1&cp=U0hVTFNRU19ITENONV9LS1dCOjZQTENFSURXdmJx&newshard=yes&id=70a5aa6b0a093e7c&signature=8B1FDA0DD8D992B56B8693F42476E2D952012E31.7B9D1A89C70A3A72D17A7C377747BFB204824CCD
)
)
但我想只给我mp4部分。我该怎么办?
答案 0 :(得分:0)
像这样:
foreach ($yourArray as &$value) {
if ($value['ext'] != 'mp4') unset($value);
}
print_r($yourArray);
或者像这样,如果你想保留原始数组:
foreach ($yourArray as &$value) {
if ($value['ext'] == 'mp4') $result[]=$value;
}
print_r($result);