@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $banner_to_print = str_replace("{Name}", $name, $banner_to_print); |
| 37 | 37 | $description = self::$color_c."Know the dangers of email credentials reuse attacks.".self::$color_g; |
| 38 | 38 | $banner_to_print = str_replace("{Description}", $description, $banner_to_print); |
| 39 | - $loaded = self::$color_b."Loaded ".self::$color_y."14".self::$color_b." website.".self::$color_g; |
|
| 39 | + $loaded = self::$color_b."Loaded ".self::$color_y."14".self::$color_b." website.".self::$color_g; |
|
| 40 | 40 | $banner_to_print = str_replace("{Loaded}", $loaded, $banner_to_print); |
| 41 | 41 | echo $banner_to_print; |
| 42 | 42 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | ini_set("memory_limit", "10240M"); |
| 3 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 3 | +require_once __DIR__.'/../autoloader.php'; |
|
| 4 | 4 | use phpspider\core\requests; |
| 5 | 5 | use phpspider\core\selector; |
| 6 | 6 | |
@@ -48,17 +48,17 @@ |
||
| 48 | 48 | |
| 49 | 49 | if (strpos($name, 'phpspider\\') === 0) |
| 50 | 50 | { |
| 51 | - $class_file = __DIR__ . substr($class_path, strlen('phpspider')) . '.php'; |
|
| 51 | + $class_file = __DIR__.substr($class_path, strlen('phpspider')).'.php'; |
|
| 52 | 52 | } |
| 53 | 53 | else |
| 54 | 54 | { |
| 55 | 55 | if (self::$_autoload_root_path) |
| 56 | 56 | { |
| 57 | - $class_file = self::$_autoload_root_path . DIRECTORY_SEPARATOR . $class_path . '.php'; |
|
| 57 | + $class_file = self::$_autoload_root_path.DIRECTORY_SEPARATOR.$class_path.'.php'; |
|
| 58 | 58 | } |
| 59 | 59 | if (empty($class_file) || !is_file($class_file)) |
| 60 | 60 | { |
| 61 | - $class_file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . "$class_path.php"; |
|
| 61 | + $class_file = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR."$class_path.php"; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | if (strpos($name, 'phpspider\\') === 0) |
| 50 | 50 | { |
| 51 | 51 | $class_file = __DIR__ . substr($class_path, strlen('phpspider')) . '.php'; |
| 52 | - } |
|
| 53 | - else |
|
| 52 | + } else |
|
| 54 | 53 | { |
| 55 | 54 | if (self::$_autoload_root_path) |
| 56 | 55 | { |
@@ -7,11 +7,11 @@ |
||
| 7 | 7 | $gmworker->addFunction("reverse", "reverse_fn"); |
| 8 | 8 | |
| 9 | 9 | print "Waiting for job...\n"; |
| 10 | -while($gmworker->work()) |
|
| 10 | +while ($gmworker->work()) |
|
| 11 | 11 | { |
| 12 | 12 | if ($gmworker->returnCode() != GEARMAN_SUCCESS) |
| 13 | 13 | { |
| 14 | - echo "return_code: " . $gmworker->returnCode() . "\n"; |
|
| 14 | + echo "return_code: ".$gmworker->returnCode()."\n"; |
|
| 15 | 15 | break; |
| 16 | 16 | } |
| 17 | 17 | //break; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 2 | +require_once __DIR__.'/../autoloader.php'; |
|
| 3 | 3 | use phpspider\core\phpspider; |
| 4 | 4 | use phpspider\core\requests; |
| 5 | 5 | |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | 'www.mafengwo.cn' |
| 16 | 16 | ), |
| 17 | 17 | 'scan_urls' => array( |
| 18 | - "http://www.mafengwo.cn/travel-scenic-spot/mafengwo/10088.html", // 随便定义一个入口,要不然会报没有入口url错误,但是这里其实没用 |
|
| 18 | + "http://www.mafengwo.cn/travel-scenic-spot/mafengwo/10088.html", // 随便定义一个入口,要不然会报没有入口url错误,但是这里其实没用 |
|
| 19 | 19 | ), |
| 20 | 20 | 'list_url_regexes' => array( |
| 21 | - "http://www.mafengwo.cn/mdd/base/list/pagedata_citylist\?page=\d+", // 城市列表页 |
|
| 22 | - "http://www.mafengwo.cn/gonglve/ajax.php\?act=get_travellist\&mddid=\d+", // 文章列表页 |
|
| 21 | + "http://www.mafengwo.cn/mdd/base/list/pagedata_citylist\?page=\d+", // 城市列表页 |
|
| 22 | + "http://www.mafengwo.cn/gonglve/ajax.php\?act=get_travellist\&mddid=\d+", // 文章列表页 |
|
| 23 | 23 | ), |
| 24 | 24 | 'content_url_regexes' => array( |
| 25 | 25 | "http://www.mafengwo.cn/i/\d+.html", |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $spider->on_start = function($phpspider) |
| 57 | 57 | { |
| 58 | - requests::set_header('Referer','http://www.mafengwo.cn/mdd/citylist/21536.html'); |
|
| 58 | + requests::set_header('Referer', 'http://www.mafengwo.cn/mdd/citylist/21536.html'); |
|
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | $spider->on_scan_page = function($page, $content, $phpspider) |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | if ($fieldname == 'date') |
| 161 | 161 | { |
| 162 | - $data = trim(str_replace(array("出发时间","/"),"", strip_tags($data))); |
|
| 162 | + $data = trim(str_replace(array("出发时间", "/"), "", strip_tags($data))); |
|
| 163 | 163 | } |
| 164 | 164 | return $data; |
| 165 | 165 | }; |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 2 | +require_once __DIR__.'/../autoloader.php'; |
|
| 3 | 3 | use phpspider\core\phpspider; |
| 4 | 4 | |
| 5 | 5 | /* Do NOT delete this comment */ |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | if ($fieldname == 'name') |
| 78 | 78 | { |
| 79 | 79 | $data = str_replace("-我爱美女网手机版", "", $data); |
| 80 | - } |
|
| 81 | - elseif ($fieldname == 'addtime') |
|
| 80 | + } elseif ($fieldname == 'addtime') |
|
| 82 | 81 | { |
| 83 | 82 | $data = time(); |
| 84 | 83 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | ini_set("memory_limit", "10240M"); |
| 3 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 3 | +require_once __DIR__.'/../autoloader.php'; |
|
| 4 | 4 | use phpspider\core\phpspider; |
| 5 | 5 | use phpspider\core\requests; |
| 6 | 6 | use phpspider\core\selector; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 2 | +require_once __DIR__.'/../autoloader.php'; |
|
| 3 | 3 | use phpspider\core\phpspider; |
| 4 | 4 | use phpspider\core\util; |
| 5 | 5 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | 91 | 'name' => "url", |
| 92 | - 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 92 | + 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 93 | 93 | 'required' => true, |
| 94 | 94 | ), |
| 95 | 95 | array( |
| 96 | 96 | 'name' => "depth", |
| 97 | - 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 97 | + 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 98 | 98 | 'required' => true, |
| 99 | 99 | ), |
| 100 | 100 | array( |
| 101 | 101 | 'name' => "taskid", |
| 102 | - 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 102 | + 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 103 | 103 | 'required' => true, |
| 104 | 104 | ), |
| 105 | 105 | ), |
@@ -161,8 +161,7 @@ discard block |
||
| 161 | 161 | //$data = substr($data, 0, 10)."..."; |
| 162 | 162 | $data = mb_substr($data, 0, 10, 'UTF-8')."..."; |
| 163 | 163 | } |
| 164 | - } |
|
| 165 | - elseif ($fieldname == 'article_publish_time') |
|
| 164 | + } elseif ($fieldname == 'article_publish_time') |
|
| 166 | 165 | { |
| 167 | 166 | // 用当前采集时间戳作为发布时间 |
| 168 | 167 | $data = time(); |
@@ -171,12 +170,10 @@ discard block |
||
| 171 | 170 | elseif ($fieldname == 'url') |
| 172 | 171 | { |
| 173 | 172 | $data = $page['url']; |
| 174 | - } |
|
| 175 | - elseif ($fieldname == 'depth') |
|
| 173 | + } elseif ($fieldname == 'depth') |
|
| 176 | 174 | { |
| 177 | 175 | $data = $page['request']['depth']; |
| 178 | - } |
|
| 179 | - elseif ($fieldname == 'taskid') |
|
| 176 | + } elseif ($fieldname == 'taskid') |
|
| 180 | 177 | { |
| 181 | 178 | $data = $page['request']['taskid']; |
| 182 | 179 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 2 | +require_once __DIR__.'/../autoloader.php'; |
|
| 3 | 3 | use phpspider\core\phpspider; |
| 4 | 4 | |
| 5 | 5 | /* Do NOT delete this comment */ |
@@ -121,8 +121,7 @@ |
||
| 121 | 121 | //$data = substr($data, 0, 10)."..."; |
| 122 | 122 | $data = mb_substr($data, 0, 10, 'UTF-8')."..."; |
| 123 | 123 | } |
| 124 | - } |
|
| 125 | - elseif ($fieldname == 'article_publish_time') |
|
| 124 | + } elseif ($fieldname == 'article_publish_time') |
|
| 126 | 125 | { |
| 127 | 126 | // 用当前采集时间戳作为发布时间 |
| 128 | 127 | $data = time(); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | //require './vendor/autoload.php'; |
| 7 | 7 | |
| 8 | 8 | // GitHub下载方式 |
| 9 | -require_once __DIR__ . '/../autoloader.php'; |
|
| 9 | +require_once __DIR__.'/../autoloader.php'; |
|
| 10 | 10 | use phpspider\core\phpspider; |
| 11 | 11 | |
| 12 | 12 | /* Do NOT delete this comment */ |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ), |
| 91 | 91 | array( |
| 92 | 92 | 'name' => "url", |
| 93 | - 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 93 | + 'selector' => "//div[contains(@class,'author')]//h2", // 这里随便设置,on_extract_field回调里面会替换 |
|
| 94 | 94 | 'required' => true, |
| 95 | 95 | ), |
| 96 | 96 | ), |
@@ -139,8 +139,7 @@ |
||
| 139 | 139 | $data = mb_substr($data, 0, 10, 'UTF-8')."..."; |
| 140 | 140 | $data = trim($data); |
| 141 | 141 | } |
| 142 | - } |
|
| 143 | - elseif ($fieldname == 'article_publish_time') |
|
| 142 | + } elseif ($fieldname == 'article_publish_time') |
|
| 144 | 143 | { |
| 145 | 144 | // 用当前采集时间戳作为发布时间 |
| 146 | 145 | $data = time(); |