(.*)<\/title>/", $str, $matches);
return $matches[1];
}
function getimg (string $str): string {
preg_match('//', $str, $matches);
$res = str_replace("https://", IMGPROXY."/", $matches[1]);
unset($matches);
return $res;
}
function getdesc (string $str): string {
$res = preg_replace('/
(.*?)<\/div>/s', "", $str);
return strip_tags($res);
}
/* 記事かの確認 */
function isarticle (string $url): bool {
$chk = explode("=", $url);
if (isset($chk[0]) && $chk[0] == "view_news.pl?id" && isset($chk[1]) && isset($chk[2])) {
$chk2 = explode("&", $chk[1]);
if (isset($chk2[1]) && $chk2[1] == "media_id") return true;
}
return false;
}
/* 記事だけが残るまで消す */
function rmbloat (string $body): string {
$res = preg_replace('/(.*?)
/s', "", $body);
$res = preg_replace('/(.*?)<\/html>/s', "", $res);
$res = preg_replace('/
(.*?)<\/p>/s', "", $res);
$res = preg_replace('/
(.*?)<\/ul>/s', "", $res);
$res = preg_replace('/(.*?)<\/table>/s', "", $res);
$res = preg_replace('/(.*?)<\/div>/s', "", $res);
$res = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $res);
$res = str_replace("", "", $res);
$res = str_replace("", "", $res);
$res = preg_replace("//", "", $res);
$res = str_replace("