1
0
Fork 0
oldhaven/php/vksearch.php

37 lines
1.0 KiB
PHP
Raw Normal View History

2011-03-29 17:51:22 +00:00
<?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';