最近由于在学习爬虫,找了很多材料来看,现在是把相关觉得适合初学者的博客和网站记下来
作为笔记,方便后续的总结和查看
1,全部的爬虫框架,多语言
http://www.itdaan.com/keywords/PHP%E7%88%AC%E8%99%AB%E6%A1%86%E6%9E%B6Beanbun%E4%BD%BF%E7%94%A8.html
2,beanbun
http://www.php.cn/php-weizijiaocheng-390759.html
3,由于之前有用到xpath,于是乎又只能去看了一遍xpath,语法挺简单,但是要学完所有函数好像还挺多的
http://www.w3school.com.cn/xpath/xpath_functions.asp
一下是用的phpspider 写的一段东西
<?php
header('Content-Type: text/html; charset=utf-8');
require './phpspider/autoloader.php';
use phpspider\core\phpspider;
use phpspider\core\requests;
use phpspider\core\selector;
use phpspider\core\log;
use phpspider\core\db;
//源码注释
/* Do NOT delete this comment */
/* 不要删除这段注释 */
$url = "https://faxian.smzdm.com/";
$html = requests::get($url);
$selector = "//div[starts-with(@class,'filter-row-con')]//div//div//child::node()[1]";
// 提取结果
$result = selector::select($html, $selector);
file_put_contents('./txt/test5.txt', $result);
比起正则,我更喜欢xpath这个匹配方法,谁叫我是正则渣渣呢。