Это кто или что ?сделал парсер мптор
ресурсЭто кто или что ?
function torrentwindows($text, $mode = false)
{
if ($mode == 'title')
{
preg_match_all ("#<h1>([\s\S]*?)</h1>#", $text, $source, PREG_SET_ORDER);
$text = $source[0][1];
$text = str_replace(' скачать торрент бесплатно', '', $text);
}
elseif ($mode == 'torrent')
{
preg_match_all ('#href= \".*?index.php\?do=download&id=([\s\S]*?)\"#', $text, $source, PREG_SET_ORDER);
$text = $source[0][1];
//var_dump($source);
}
else
{
$pos = strpos($text, '<br class="clearfix" />');
$text = substr($text, $pos);
$pos = strpos($text, '<center><span class="attachment"><center>');
$text = substr($text, 0, $pos);
$text = preg_replace("/<br class=\"clearfix\" \/>\n\n/", '', $text);
/*
preg_match_all ('/<meta property="og:image" content="([\s\S]*?)">/', $text, $pic, PREG_SET_ORDER);
$poster = ($pic[0][1]) ? "[img=right]". $pic[0][1] ."[/img]\n\n" : "";
$text = preg_replace('/<\/center><div style="text-align:center;"><!--TBegin.*?--><a href="(.*?)".*?><img src=".*?".*?><\/a><!--TEnd--><\/div>/', "[img=right]$1[/img]\n", $text);
*/
$text = str_replace(' ', ' ', $text);
$text = str_replace('<div', '<span', $text);
$text = str_replace('</div>', '</span>', $text);
$text = preg_replace('/<a href="javascript[^<]*?"><img id="image.*?" style="vertical-align: middle;border: none;" alt="" src=".*?" \/><\/a>/', '', $text);
$text = preg_replace_callback(
"/<span style=\"color:rgb\(([\s\S]*?)\);\">/msi",
function($matches){
foreach($matches as $match)
$match = rgb2html($match);
{
return "<span style=\"color:rgb$match;\">";
}
},
$text
);
$text = preg_replace('/<!--.*?-->/', '', $text);
$text = preg_replace('/<!--dle_image_begin.*?<img src="(.*?)".*?><!--dle_image_end-->/', '[img]$1[/img]', $text);
$text = preg_replace('/<span class="masha_index.*?"><\/span>/', '', $text);
$text = preg_replace("/<span style=\"font-size: 15px;\">[\s\S]*?<a class=\"highslide\" href=\"(.*?)\" target=\"_blank\"><img src=\".*?\" alt=\"\" class=\"fr-dib\"><\/a>/", "[img=right]$1[/img]\n\n", $text);
/*
$text = preg_replace('/<!--dle_spoiler.*? -->/', '', $text);
$text = preg_replace('/<!--spoiler[\s\S]*?-->/', '', $text);
$text = preg_replace('/<div class="v_text">[\s\S]*?<a href=".*?={name}">[\s\S]*?<\/a><\/center>[\s\S]*?<\/center>/', '', $text);
$text = preg_replace('/<div style="text-align:([\s\S]*?);">([\s\S]*?)<(?=\/)\/div>/', '[align=$1]$2[/align]', $text);
$text = preg_replace('/<a href="(.*?)" rel="highslide" class="highslide"><img src=".*?" alt=\'.*?\' title=\'.*?\' \/><\/a>/', '[img=right]$1[/img]', $text);
$text = preg_replace('/<img src="\/uploads\/posts\/([\s\S]*?)\" alt=".*?" title=".*?">/', '[img]https://torrent-windows.net/uploads/posts/$1[/img]', $text);
*/
$text = preg_replace('/<a href="javascript[^<]*?">([^<]*?)<(?=\/)\/a>/', '$1', $text);
$text = preg_replace('/<center><a href="https.*?sub2.bubblesmedia.ru.*?"><img src="\/.*?.jpg"><\/a><\/center>/', '', $text);
$text = preg_replace('/<center><a href=".*?" target="_blank"><span.*?><noindex>.*?<\/noindex><\/span><\/a>.*?<\/center>/', '', $text);
for ($i=0; $i<=20; $i++)
{
$text = preg_replace('/<img src="\/uploads\/posts\/([\s\S]*?)\" style=".*?" alt="">/', '[img]https://torrent-windows.net/uploads/posts/$1[/img]', $text);
$text = str_replace('<br>', "\n", $text);
$text = str_replace('<br />', "\n", $text);
$text = str_replace('<hr>', '[hr]', $text);
$text = str_replace('<u>', "[u]", $text);
$text = str_replace('</u>', "[/u]", $text);
$text = str_replace('<b>', "[b]", $text);
$text = str_replace('</b>', "[/b]", $text);
$text = str_replace('<i>', "[i]", $text);
$text = str_replace('</i>', "[/i]", $text);
$text = str_replace('<li>', "\n[*]", $text);
$text = str_replace('</li>', '', $text);
$text = preg_replace('/<span style="font-size:(.*?)pt;">([\s\S]*?)<(?=\/)\/span>/', '[size=\\1]\\2[/size]', $text);
$text = preg_replace('/<span style="font-size:(.*?)px;line-height:normal;">([\s\S]*?)<(?=\/)\/span>/', '[size=\\1]\\2[/size]', $text);
$text = preg_replace('/<img src="([\s\S]*?)" class="fr-fic fr-dii".*?>/', '[img]$1[/img]', $text);
$text = preg_replace('/<a href="([^<]*?)".*?target="_blank".*?>([^<]*?)<\/a>/', '[url=$1]$2[/url] ', $text);
$text = preg_replace('/<a href="([\s\S]*?)".*?target="_blank" rel="noopener external noreferrer">([\s\S]*?)<(?=\/)\/a>/', '[url=$1]$2[/url]', $text);
$text = preg_replace('/<span style="color:rgb([^<]*?);">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text);
$text = preg_replace('/<span style="color:([^<]*?);.*?">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text);
$text = preg_replace('/<span style="font-weight:bold;">([^<]*?)<(?=\/)\/span>/', '[b]$1[/b]', $text);
$text = preg_replace('/<span style="text-align:([^<]*?);display:block;">([\s\S]*?)<(?=\/)\/span>/', "[align=\\1]\n\\2\n[/align]", $text);
$text = preg_replace('/<span align="([^<]*?)">([^<]*?)<(?=\/)\/span>/', "[align=\\1]\\2[/align]", $text);
$text = preg_replace('/<span style="text-decoration:underline;">([^<]*?)<(?=\/)\/span>/', '[u]$1[/u]', $text);
$text = preg_replace('/<span class="title_spoiler">([^<]*?)<(?=\/)\/span><span.*?class="text_spoiler" style="display:none;">([^<]*?)<(?=\/)\/span>/', '[spoiler="$1"]$2[/spoiler]', $text);
//$text = preg_replace('/<!--spoiler_title-->([\s\S]*?)<!--spoiler_title_end-->.*?<!--spoiler_text-->([\s\S]*?)<!--spoiler_text_end--><(?=\/)\/div>/', "[spoiler=\\1]\n\\2\n[/spoiler]", $text);
$text = preg_replace('/http:(.*?)fastpic.ru/', "https:$1fastpic.ru/", $text);
$text = preg_replace('/http:(.*?)imageban.ru/', "https:$1imageban.ru/", $text);
$text = preg_replace('/http:(.*?)youpic.su/', "https:$1youpic.su/", $text);
$text = preg_replace('/http:(.*?)lostpic.net/', "https:$1lostpic.net/", $text);
$text = preg_replace('/http:(.*?)*******.host/', "https:$1radikal.host/", $text);
$text = str_replace('http://img-fotki.yandex.ru', 'https://img-fotki.yandex.ru', $text);
}
if(strlen($text) > 55){
false;
}
else{
$text = preg_replace('#<br />(.*?):#', "[b]$1:[/b] ", $text);
$text = preg_replace('#<br>(.*?):#', "[b]$1:[/b] ", $text);
}
$text = preg_replace('/<a class="highslide" href="(.*?)" target="_blank"><img src=".*?" alt="" class="fr-dib"><\/a>/', '[th]$1[/th]', $text);
$text = str_replace('Скачать торрент:', "", $text);
$text = str_replace('Состав раздачи', "", $text);
$text = str_replace('Показать / Скрыть текст', "", $text);
$text = preg_replace('/\[url=.*?multi-up.com.*?\].*?\[\/url\]/', "", $text);
//$text = str_replace('Версия программы:', "[b]Версия программы:[/b]", $text);
// Убираем пустое пространство
//$text = preg_replace('#([\r\n])[\s]+#is', "$1", $text);
$text = strip_tags(html_entity_decode($text));
}
$text = preg_replace_callback('/<a href=".*?">(.*?)<\/a>/', function ($v)
{
return '[url=https://www.hitrustor.me/tracker.php?' . http_build_query(['nm' => $v[1]]) . ']' . $v[1] . '[/url]';
},
$text);
return $text;
}
Fight for the kingdom, fighting with steelPHP:function torrentwindows($text, $mode = false) { if ($mode == 'title') { preg_match_all ("#<h1>([\s\S]*?)</h1>#", $text, $source, PREG_SET_ORDER); $text = $source[0][1]; $text = str_replace(' скачать торрент бесплатно', '', $text); } elseif ($mode == 'torrent') { preg_match_all ('#href= \".*?index.php\?do=download&id=([\s\S]*?)\"#', $text, $source, PREG_SET_ORDER); $text = $source[0][1]; //var_dump($source); } else { $pos = strpos($text, '<br class="clearfix" />'); $text = substr($text, $pos); $pos = strpos($text, '<center><span class="attachment"><center>'); $text = substr($text, 0, $pos); $text = preg_replace("/<br class=\"clearfix\" \/>\n\n/", '', $text); /* preg_match_all ('/<meta property="og:image" content="([\s\S]*?)">/', $text, $pic, PREG_SET_ORDER); $poster = ($pic[0][1]) ? "[img=right]". $pic[0][1] ."[/img]\n\n" : ""; $text = preg_replace('/<\/center><div style="text-align:center;"><!--TBegin.*?--><a href="(.*?)".*?><img src=".*?".*?><\/a><!--TEnd--><\/div>/', "[img=right]$1[/img]\n", $text); */ $text = str_replace(' ', ' ', $text); $text = str_replace('<div', '<span', $text); $text = str_replace('</div>', '</span>', $text); $text = preg_replace('/<a href="javascript[^<]*?"><img id="image.*?" style="vertical-align: middle;border: none;" alt="" src=".*?" \/><\/a>/', '', $text); $text = preg_replace_callback( "/<span style=\"color:rgb\(([\s\S]*?)\);\">/msi", function($matches){ foreach($matches as $match) $match = rgb2html($match); { return "<span style=\"color:rgb$match;\">"; } }, $text ); $text = preg_replace('/<!--.*?-->/', '', $text); $text = preg_replace('/<!--dle_image_begin.*?<img src="(.*?)".*?><!--dle_image_end-->/', '[img]$1[/img]', $text); $text = preg_replace('/<span class="masha_index.*?"><\/span>/', '', $text); $text = preg_replace("/<span style=\"font-size: 15px;\">[\s\S]*?<a class=\"highslide\" href=\"(.*?)\" target=\"_blank\"><img src=\".*?\" alt=\"\" class=\"fr-dib\"><\/a>/", "[img=right]$1[/img]\n\n", $text); /* $text = preg_replace('/<!--dle_spoiler.*? -->/', '', $text); $text = preg_replace('/<!--spoiler[\s\S]*?-->/', '', $text); $text = preg_replace('/<div class="v_text">[\s\S]*?<a href=".*?={name}">[\s\S]*?<\/a><\/center>[\s\S]*?<\/center>/', '', $text); $text = preg_replace('/<div style="text-align:([\s\S]*?);">([\s\S]*?)<(?=\/)\/div>/', '[align=$1]$2[/align]', $text); $text = preg_replace('/<a href="(.*?)" rel="highslide" class="highslide"><img src=".*?" alt=\'.*?\' title=\'.*?\' \/><\/a>/', '[img=right]$1[/img]', $text); $text = preg_replace('/<img src="\/uploads\/posts\/([\s\S]*?)\" alt=".*?" title=".*?">/', '[img]https://torrent-windows.net/uploads/posts/$1[/img]', $text); */ $text = preg_replace('/<a href="javascript[^<]*?">([^<]*?)<(?=\/)\/a>/', '$1', $text); $text = preg_replace('/<center><a href="https.*?sub2.bubblesmedia.ru.*?"><img src="\/.*?.jpg"><\/a><\/center>/', '', $text); $text = preg_replace('/<center><a href=".*?" target="_blank"><span.*?><noindex>.*?<\/noindex><\/span><\/a>.*?<\/center>/', '', $text); for ($i=0; $i<=20; $i++) { $text = preg_replace('/<img src="\/uploads\/posts\/([\s\S]*?)\" style=".*?" alt="">/', '[img]https://torrent-windows.net/uploads/posts/$1[/img]', $text); $text = str_replace('<br>', "\n", $text); $text = str_replace('<br />', "\n", $text); $text = str_replace('<hr>', '[hr]', $text); $text = str_replace('<u>', "[u]", $text); $text = str_replace('</u>', "[/u]", $text); $text = str_replace('<b>', "[b]", $text); $text = str_replace('</b>', "[/b]", $text); $text = str_replace('<i>', "[i]", $text); $text = str_replace('</i>', "[/i]", $text); $text = str_replace('<li>', "\n[*]", $text); $text = str_replace('</li>', '', $text); $text = preg_replace('/<span style="font-size:(.*?)pt;">([\s\S]*?)<(?=\/)\/span>/', '[size=\\1]\\2[/size]', $text); $text = preg_replace('/<span style="font-size:(.*?)px;line-height:normal;">([\s\S]*?)<(?=\/)\/span>/', '[size=\\1]\\2[/size]', $text); $text = preg_replace('/<img src="([\s\S]*?)" class="fr-fic fr-dii".*?>/', '[img]$1[/img]', $text); $text = preg_replace('/<a href="([^<]*?)".*?target="_blank".*?>([^<]*?)<\/a>/', '[url=$1]$2[/url] ', $text); $text = preg_replace('/<a href="([\s\S]*?)".*?target="_blank" rel="noopener external noreferrer">([\s\S]*?)<(?=\/)\/a>/', '[url=$1]$2[/url]', $text); $text = preg_replace('/<span style="color:rgb([^<]*?);">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text); $text = preg_replace('/<span style="color:([^<]*?);.*?">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text); $text = preg_replace('/<span style="font-weight:bold;">([^<]*?)<(?=\/)\/span>/', '[b]$1[/b]', $text); $text = preg_replace('/<span style="text-align:([^<]*?);display:block;">([\s\S]*?)<(?=\/)\/span>/', "[align=\\1]\n\\2\n[/align]", $text); $text = preg_replace('/<span align="([^<]*?)">([^<]*?)<(?=\/)\/span>/', "[align=\\1]\\2[/align]", $text); $text = preg_replace('/<span style="text-decoration:underline;">([^<]*?)<(?=\/)\/span>/', '[u]$1[/u]', $text); $text = preg_replace('/<span class="title_spoiler">([^<]*?)<(?=\/)\/span><span.*?class="text_spoiler" style="display:none;">([^<]*?)<(?=\/)\/span>/', '[spoiler="$1"]$2[/spoiler]', $text); //$text = preg_replace('/<!--spoiler_title-->([\s\S]*?)<!--spoiler_title_end-->.*?<!--spoiler_text-->([\s\S]*?)<!--spoiler_text_end--><(?=\/)\/div>/', "[spoiler=\\1]\n\\2\n[/spoiler]", $text); $text = preg_replace('/http:(.*?)fastpic.ru/', "https:$1fastpic.ru/", $text); $text = preg_replace('/http:(.*?)imageban.ru/', "https:$1imageban.ru/", $text); $text = preg_replace('/http:(.*?)youpic.su/', "https:$1youpic.su/", $text); $text = preg_replace('/http:(.*?)lostpic.net/', "https:$1lostpic.net/", $text); $text = preg_replace('/http:(.*?)*******.host/', "https:$1radikal.host/", $text); $text = str_replace('http://img-fotki.yandex.ru', 'https://img-fotki.yandex.ru', $text); } if(strlen($text) > 55){ false; } else{ $text = preg_replace('#<br />(.*?):#', "[b]$1:[/b] ", $text); $text = preg_replace('#<br>(.*?):#', "[b]$1:[/b] ", $text); } $text = preg_replace('/<a class="highslide" href="(.*?)" target="_blank"><img src=".*?" alt="" class="fr-dib"><\/a>/', '[th]$1[/th]', $text); $text = str_replace('Скачать торрент:', "", $text); $text = str_replace('Состав раздачи', "", $text); $text = str_replace('Показать / Скрыть текст', "", $text); $text = preg_replace('/\[url=.*?multi-up.com.*?\].*?\[\/url\]/', "", $text); //$text = str_replace('Версия программы:', "[b]Версия программы:[/b]", $text); // Убираем пустое пространство //$text = preg_replace('#([\r\n])[\s]+#is', "$1", $text); $text = strip_tags(html_entity_decode($text)); } $text = preg_replace_callback('/<a href=".*?">(.*?)<\/a>/', function ($v) { return '[url=https://www.hitrustor.me/tracker.php?' . http_build_query(['nm' => $v[1]]) . ']' . $v[1] . '[/url]'; }, $text); return $text; }