Created
November 30, 2011 18:17
-
-
Save feuvan/1410113 to your computer and use it in GitHub Desktop.
Parse bilibili.tv video page and return acg.tv short url, vid.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = $_GET["url"]; | |
$vid = 0; | |
$acgtv = ""; | |
if (preg_match("/http:\/\/www.bilibili.tv\/video\/(av\\d+)/", $url, $matches)) { | |
$acgtv = $matches[1]; | |
$response = file_get_contents($url); | |
preg_match("/vid=(\\d+)/", $response, $matches); | |
$vid = $matches[1]; | |
} | |
print json_encode(array("vid"=>$vid, "acgtv"=>$acgtv)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment