$encodiedThreadBaseHtml = threadSteal(getPDO(), $ip, "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"])); $threadData = threadReArray(threadDataPregMatch($encodiedThreadBaseHtml, getDiRegex(getPDO(), "threadStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"])), $threadUrl, $censorList); threadInsert(getPDO(), $threadData, $menuData["id"], $menuData["kind"], $queryList["INSERT_THREAD"]); unset($threadData); } if ($isResSteal) { $threadData = getThreadData(getPDO(), $menuData["id"], $queryList["SELECT_THREAD"]); $i = 0; foreach ($threadData as $value) { if ($value["thread_now_res_no"] - $value["res_end"] < (int) $fixedList["updateWaiting"]) { continue; } else { timeWeit((int) $fixedList["weitTimeMin"], (int) $fixedList["weitTimeMax"]); } $ip = useIp(getPDO(), getUseIpMod(getPDO())); $encodiedResBaseHtml = resSteal(getPDO(), $ip, "resSteal", $value["thread_url"], $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"])); if (!$encodiedResBaseHtml) { continue; } $isoldLog = threadIsOldLog($encodiedResBaseHtml, getDiRegex(getPDO(), "threadOldlogedRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"])); if ($isoldLog) { threadUpdateTois_oldlog($value["thread_sha"], $prepareStForTUIO, $dbHandle); } $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, $value["thread_sha"]); if (!$resData) { continue; } $ankaerLinkProced = resBodyAnkaerLinkProc($resData, getDiRegex(getPDO(), "resBodyAnkaerLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"])); if ($menuData["kind"] === "open2ch.net") { $imgLinkProced = resBodyImgLinkProcO(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]); } else {
function resDataProc($dbHandle, $threadData, $kind, $resStealRegex, $resBodyAnkaerLinkStealRegex, $resBodyImgLinkStealRegex, $threadOldLogedRegex, $prepareStForRI, $prepareStForTUPTR, $prepareStForTUIO, $prepareStForTUTI, $prepareStForTUNOS, $imgBaseUrl, $censorList) { $i = 0; foreach ($threadData as $value) { if ($i > 2) { break; } $encodiedResBaseHtml = resSteal($value["thread_url"]); $isoldLog = threadIsOldLog($encodiedResBaseHtml, $threadOldLogedRegex); if ($isoldLog) { threadUpdateTois_oldlog($value["thread_sha"], $prepareStForTUIO, $dbHandle); } $resData = getResArray($resStealRegex, $encodiedResBaseHtml, $value["thread_sha"]); $ankaerLinkProced = resBodyAnkaerLinkProc($resData, $resBodyAnkaerLinkStealRegex); $imgLinkProced = resBodyImgLinkProc($dbHandle, $ankaerLinkProced, $value["thread_sha"], $resBodyImgLinkStealRegex, $prepareStForTUTI, $imgBaseUrl); $censoredProced = censorShipForRes($imgLinkProced, $censorList); $net_or_sc_kind = kindChecher($censoredProced[0]["res_id"]); $resDataArray = resDataReArray($censoredProced, $net_or_sc_kind); $countOfResDataArray = count($resDataArray); //MAX RES number. resInsert($dbHandle, $resDataArray, $kind, $prepareStForRI); threadUpdateTonet_or_sc($dbHandle, $net_or_sc_kind, $value["thread_sha"], $prepareStForTUNOS); threadUpdateToRes_end($dbHandle, $value["thread_sha"], $countOfResDataArray, $prepareStForTUPTR); unset($resDataArray, $censoredProced, $imgLinkProced, $ankaerLinkProced, $encodiedResBaseHtml, $resStealBool); $i++; } unset($value); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/functions.php'; require_once dirname(dirname(__FILE__)) . '/wp-load.php'; date_default_timezone_set('Asia/Tokyo'); $queryList = getSQLQuery(getPDO()); $censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]); $regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]); $fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]); // $encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/l50", $queryList["INSERT_IP_ACCESS"]); // var_dump($encodiedResBaseHtml); $encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/", $queryList["INSERT_IP_ACCESS"]); // $encodiedResBaseHtml = file_get_contents("./imghtml.html"); $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", "open2ch.net", $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, "000000000000000"); $data = resBodyImgLinkProc(getPDO(), $resData, $threadSha, $regexList["ExresBodyImgLinkStealRegex"], $queryList["SELECT_RES"], $fixedList["imgSavePath"], "open2ch.net"); var_dump($data); // $html = file_get_contents("http://hayabusa.open2ch.net/test/read.cgi/livejupiter/1449141846/l50"); // $regexBase = "/<?[div\sclass=\"imgur]*>?<a.+><img.*data-original=\"(.+)\"\s.+>[<br.>]*<\/a><?[\/div\n]*>?/u"; // $regexImg = "/<img.+data-original=\"(.+)\"\s.+>/u"; // preg_match_all($regexBase, $html, $match, PREG_SET_ORDER); // $splitArray = []; // // foreach ($match as $value) { // $splitArray[] = preg_replace("/<\/div>/", "</div>\n", $value); // } // // $imgAllay = []; // foreach ($splitArray as $value) { // preg_match_all($regexBase, $value[0], $imgUrl, PREG_SET_ORDER); // $imgAllay[] = $imgUrl; // }