[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Массивы! Как взять и сформировать всё нужное
george_te
Здравствуйте есть код, часть кода

YT.php

 public static function get_links(){
if(!empty(self::$links)) return self::$links;
if(empty(self::$info)) self::get_info();
$links_map = explode(',',self::$info['url_encoded_fmt_stream_map']);
$fmt_list = explode(',',self::$info['fmt_list']);
foreach($links_map as $key => $link){
parse_str($link,$parts);
$link = $parts['url'].='&signature='.$parts['sig'];
$fmt_parts = explode('/', $fmt_list[$key],3);
# Create array of information of video
self::$links[self::$formats[$parts['itag']] .'-'. $fmt_parts[1]] = array(self::$formats[$parts['itag']], $fmt_parts[1], $link);
}
return self::$links;
}

INDEX.php

echo '<pre>';
print_r(YT::get_links());
echo '</pre>';


выводит мне

Array
(
[
webm-1280x720] => Array
(
[
0] => webm
[1] => 1280x720
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?ms=au&source=youtube&newshard=yes& ipbits=8&ratebypass=yes&ip=95.137.227.151&key=yt1&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=45&id=cd5027d1df9fe4ad&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&upn=BNNASOYHNTk&mt=1370713228&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&sig nature=23F2D384FF9D368EF434C136FBDBA5C8F716E34D.1BB917C4E4B52B6C0691580DBFABD0D673941575
)

[
mp4-1280x720] => Array
(
[
0] => mp4
[1] => 1280x720
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?ms=au&source=youtube&newshard=yes& ipbits=8&ratebypass=yes&ip=95.137.227.151&key=yt1&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=22&id=cd5027d1df9fe4ad&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&upn=BNNASOYHNTk&mt=1370713228&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&sig nature=020A5CE8AEDDE88E71BB7FD459AE9A6CE170BF1F.727CC5B6E54BB19ED5624737D6A4EC9047B5B64A
)

[
webm-854x480] => Array
(
[
0] => webm
[1] => 854x480
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?ms=au&source=youtube&newshard=yes& ipbits=8&ratebypass=yes&ip=95.137.227.151&key=yt1&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=44&id=cd5027d1df9fe4ad&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&upn=BNNASOYHNTk&mt=1370713228&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&sig nature=2FE123BE670E137E37BABBBA916127DBD318682D.C28D846987D8C5BA079434D796F034C8769CCFFB
)

[
flv-854x480] => Array
(
[
0] => flv
[1] => 854x480
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?burst=40&algorithm=throttle-factor&ms=au&source=youtube&newshard=yes&ipbits=8&ip=95.1 37.227.151&key=yt1&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource %2Cupn%2Cexpire&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=35&id=cd5027d1df9fe4ad&factor=1.25&upn=BNNASOYHNTk&mt=1370713228&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&mv=m&signature=510122909FD3161953197401BF66EE55C3CFD6EE.615517708C54F5741BD563349FF2149B9E8C26EA
)

[
webm-640x360] => Array
(
[
0] => webm
[1] => 640x360
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?ms=au&source=youtube&newshard=yes& ipbits=8&ratebypass=yes&ip=95.137.227.151&key=yt1&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=43&id=cd5027d1df9fe4ad&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&upn=BNNASOYHNTk&mt=1370713228&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&sig nature=022F1B71D1B0A37EA4C3E49DB9A7EE4D6603A27C.8EEF3B9CC73ED315E89C211CA35141A0B002CBDA
)

[
flv-640x360] => Array
(
[
0] => flv
[1] => 640x360
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?burst=40&algorithm=throttle-factor&ms=au&source=youtube&newshard=yes&ipbits=8&ip=95.1 37.227.151&key=yt1&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource %2Cupn%2Cexpire&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=34&id=cd5027d1df9fe4ad&factor=1.25&upn=BNNASOYHNTk&mt=1370713228&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&mv=m&signature=3743075F154F0FF2EDC34D7BCFBAD6DE0EE7FAF0.848335EF8FF54106EEC7DD240033C47DE3DBE563
)

[
mp4-640x360] => Array
(
[
0] => mp4
[1] => 640x360
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?ms=au&source=youtube&newshard=yes& ipbits=8&ratebypass=yes&ip=95.137.227.151&key=yt1&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=18&id=cd5027d1df9fe4ad&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&upn=BNNASOYHNTk&mt=1370713228&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&sig nature=1BF7EB068F6C8F5E94F7C844FE3F51C6C88EA8D3.7C8B14881A7B70BD2E2EDC028298FCA15748F56B
)

[
flv-320x240] => Array
(
[
0] => flv
[1] => 320x240
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?burst=40&algorithm=throttle-factor&ms=au&source=youtube&newshard=yes&ipbits=8&ip=95.1 37.227.151&key=yt1&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource %2Cupn%2Cexpire&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=5&id=cd5027d1df9fe4ad&factor=1.25&upn=BNNASOYHNTk&mt=1370713228&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&mv=m&signature=AD8E47F74B24553A149142A520EA61C43B39B966.187F64F9690D955895D3DFCD4A9E2994AC3A30BE
)

[
3gp-320x240] => Array
(
[
0] => 3gp
[1] => 320x240
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?burst=40&algorithm=throttle-factor&ms=au&source=youtube&newshard=yes&ipbits=8&ip=95.1 37.227.151&key=yt1&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource %2Cupn%2Cexpire&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=36&id=cd5027d1df9fe4ad&factor=1.25&upn=BNNASOYHNTk&mt=1370713228&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&mv=m&signature=A060FACF99355AF33118E20FC67D397E34C56F4F.94569A46FA02FF8AC173352CBC4EA287D7797A2B
)

[
3gp-176x144] => Array
(
[
0] => 3gp
[1] => 176x144
[2] => http://r7---sn-gvnuxaxjvh-n8vl.c.youtube.com/videoplayback?burst=40&algorithm=throttle-factor&ms=au&source=youtube&newshard=yes&ipbits=8&ip=95.1 37.227.151&key=yt1&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource %2Cupn%2Cexpire&expire=1370736218&sver=3&fexp=901454%2C900352%2C924605%2C928201%2C901208%2C929123%2C929915%2C929906%2C929907%2C925714%2C929919%2C929119%2C931202%2C928017%2C912512%2C912515%2C912521%2C906906%2C931913%2C919373%2C906836%2C933701%2C919008%2C900816%2C926403%2C912711%2C930621%2C929606%2C910075&itag=17&id=cd5027d1df9fe4ad&factor=1.25&upn=BNNASOYHNTk&mt=1370713228&cp=U0hWRVdOVF9GUkNONl9PSFhDOjdiamZTRG9obHRn&mv=m&signature=79CA3E0205A874E8EEA352212348001A5C9DEEDC.3CAE6D7865CDECE279057431C90E7BDC07150088
)

)


мне надо вывести все существующие ссылки массивов!

1 ссылка
2 ссылка
3 ссылка
не получается! пытаюсь

foreach($links as $key => $value){

echo $links["webm-1280x720"][2];

}

да выводится 10 раз как и есть! но я рукой прописываю тут ["webm-1280x720"] как автоматом сделать вывод? надеюсь я нормально объяснил! надо что то типа


<a href="ссылка">скачать 3gp / 176x144</a>
и так прокрутить все данные массива!

Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.