Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as PHP by AAV ( 17 years ago )
<?php
/**
* videosaver - Плагин Ð´Ð»Ñ SteelBot, оболочка над videosaver.ru
*
* http://steelbot.net
*
* @author AAVezel
* @version 1.0
*
* 2009-03-05
*
*/
class videosaver{
static $optionregexp = "/<option.*?value="(.*?)" .*?>(.*?)</option>/",
$linkregexp = "/<a id="rlink" href="(.*?)" .*?>.*?</a>/",
$videosaver_url = "http://cs.videosaver.ru/xurl/";
static function getVideoURL($siteurl){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, self::$videosaver_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "url=".urlencode($siteurl));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
$ret=iconv("UTF-8", "WINDOWS-1251", $ret);
if (preg_match_all(self::$optionregexp, $ret, $regs))
{
$len = count($regs[0]);
for($i=0;$i<$len;$i++)
{
$returns .= iconv("WINDOWS-1251", "UTF-8", $regs[2][$i]." : ".$regs[1][$i]."
");
}
}
else
{
if (preg_match_all(self::$linkregexp, $ret, $regs))
{
$returns .= $regs[1][0]."
";
}
else
{
$returns = "Ðет такого файла
";
}
}
slog::add('videosaver',"video: $siteurl");
return $returns;
}
static function sb_message($params){
$returns = self::getVideoURL($params);
$returns .="
--
videosaver.ru";
SteelBot::Msg($returns);
}
}
SteelBot::RegisterCmd("video", array('videosaver', 'sb_message'), 0, "video <video_url> - Получить путь Ð´Ð»Ñ Ð·Ð°ÐºÐ°Ñ‡ÐºÐ¸");
Revise this Paste
Parent: 5710