37 lines
1.0 KiB
PHP
37 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
require_once 'classes/Vkontakte.class.php';
|
||
|
require_once 'classes/File.class.php';
|
||
|
require_once 'classes/Match.class.php';
|
||
|
require_once 'classes/RemoteFile.class.php';
|
||
|
|
||
|
$_POST['q'] = 'Queen';
|
||
|
|
||
|
if (isset($_POST['q'])) {
|
||
|
$q = File::prepareQuery($_POST['q']);
|
||
|
$t_start = microtime(true);
|
||
|
if (! file_exists('dump/html/'. $q .'.html')) {
|
||
|
$parser = new Vkontakte();
|
||
|
$files = $parser->parse($q);
|
||
|
foreach ($files as $i => $file) {
|
||
|
$size = File::getSizeByUrl($file['url']);
|
||
|
if ($size) {
|
||
|
$files[$i]['size'] = $size;
|
||
|
$files[$i]['bitrate'] = File::calculateBitrate($files[$i]['size'], $files[$i]['duration']);
|
||
|
} else {
|
||
|
unset($files[$i]);
|
||
|
}
|
||
|
}
|
||
|
//file_put_contents('dump/html/'. $q .'.html', $parser->getHtml());
|
||
|
//file_put_contents('dump/data/'. $q .'.data', serialize($files));
|
||
|
} else {
|
||
|
$files = unserialize(file_get_contents('dump/data/'. $q .'.data'));
|
||
|
}
|
||
|
$t_end = microtime(true);
|
||
|
$files = File::formatData($files);
|
||
|
}
|
||
|
|
||
|
$completed = array_slice(scandir('dump/data'), 2);
|
||
|
|
||
|
|
||
|
include 'tpl/vksearch.php';
|