Skip to content

Instantly share code, notes, and snippets.

@feuvan
Created November 30, 2011 18:17
Show Gist options
  • Save feuvan/1410113 to your computer and use it in GitHub Desktop.
Save feuvan/1410113 to your computer and use it in GitHub Desktop.
Parse bilibili.tv video page and return acg.tv short url, vid.
<?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