0

xiph.orgからすべてのURLを取得する方法はありますか?Webアプリケーションから特定のラジオまたは特定のカテゴリのラジオを取得するためにサイトに直接クエリを実行する方法はありますか?

4

2 に答える 2

0

わかりました、そのサイトでそれらのストリームのいくつかを見てきました。

XSPFファイルをテキスト エディターで開くと、ストリームが<location>タブでラップされた XML が表示されます。

これには、ある種のクローラーをセットアップする必要があります。簡単なものをお作りします。

//define the link
$link = 'http://dir.xiph.org/';

//get the contents
$contents = file_get_contents($link);

preg_match_all('|"/listen/(.*)/listen.m3u"|',$contents,$match);


//define xspf link array
$xspfLinks = array();

//define default link
$xspfLink = 'http://dir.xiph.org/listen/';

//define final stream array
$finalStream=array();

foreach ($match[1] as $id )
{
    //assign ID to default link and throw it in the array
    $xspfLinks[]=$xspfLink.$id.'/listen.xspf';

}

// now loop through that array
foreach ($xspfLinks as $hehehe )
{
    //download xspf file
    $xspf = file_get_contents($hehehe);

    if(preg_match('|<location>(.*)</location>|',$xspf,$heheMatch))
    {

        //put stream url in final array
        $finalStream[]=$heheMatch[1];
        //test it
        echo 'HEHEHEHE I just stole:'.$heheMatch[1]."<br>";

    }
}

//now do as you please with $finalStream (it will contain all your stream urls)

私はあなたのためにすべてをやっただけです-_-。しかし、ええ、それはうまくいくはずです。

ああ、もう1つ、あなたがばかげて、盗むべきではないときにそれらのストリームを盗んでいる場合、私は責任を負いません.

于 2012-08-07T07:59:05.387 に答える