{"id":13536376,"url":"https://github.com/owner888/phpspider","last_synced_at":"2026-01-11T16:46:50.608Z","repository":{"id":41207531,"uuid":"40277672","full_name":"owner888/phpspider","owner":"owner888","description":"《我用爬虫一天时间“偷了”知乎一百万用户，只为证明PHP是世界上最好的语言 》所使用的程序","archived":false,"fork":false,"pushed_at":"2024-12-15T03:16:14.000Z","size":5478,"stargazers_count":3495,"open_issues_count":119,"forks_count":1171,"subscribers_count":232,"default_branch":"master","last_synced_at":"2025-03-16T03:45:31.100Z","etag":null,"topics":["php","phpspider"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owner888.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-06T01:33:17.000Z","updated_at":"2025-03-12T07:38:11.000Z","dependencies_parsed_at":"2022-08-10T01:43:11.366Z","dependency_job_id":null,"html_url":"https://github.com/owner888/phpspider","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owner888%2Fphpspider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owner888%2Fphpspider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owner888%2Fphpspider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owner888%2Fphpspider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owner888","download_url":"https://codeload.github.com/owner888/phpspider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246750771,"owners_count":20827779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","phpspider"],"created_at":"2024-08-01T09:00:38.114Z","updated_at":"2026-01-11T16:46:50.555Z","avatar_url":"https://github.com/owner888.png","language":"PHP","funding_links":[],"categories":["PHP","PHP (184)"],"sub_categories":[],"readme":"# phpspider -- PHP蜘蛛爬虫框架\n《我用爬虫一天时间“偷了”知乎一百万用户，只为证明PHP是世界上最好的语言 》所使用的程序  \n\nphpspider是一个爬虫开发框架。使用本框架，你不用了解爬虫的底层技术实现，爬虫被网站屏蔽、有些网站需要登录或验证码识别才能爬取等问题。简单几行PHP代码，就可以创建自己的爬虫，利用框架封装的多进程Worker类库，代码更简洁，执行效率更高速度更快。\n\ndemo目录下有一些特定网站的爬取规则，只要你安装了PHP环境，代码就可以在命令行下直接跑。 对爬虫感兴趣的开发者可以加QQ群一起讨论：147824717。\n\n下面以糗事百科为例, 来看一下我们的爬虫长什么样子:\n\n```\n$configs = array(\n    'name' =\u003e '糗事百科',\n    'domains' =\u003e array(\n        'qiushibaike.com',\n        'www.qiushibaike.com'\n    ),\n    'scan_urls' =\u003e array(\n        'http://www.qiushibaike.com/'\n    ),\n    'content_url_regexes' =\u003e array(\n        \"http://www.qiushibaike.com/article/\\d+\"\n    ),\n    'list_url_regexes' =\u003e array(\n        \"http://www.qiushibaike.com/8hr/page/\\d+\\?s=\\d+\"\n    ),\n    'fields' =\u003e array(\n        array(\n            // 抽取内容页的文章内容\n            'name' =\u003e \"article_content\",\n            'selector' =\u003e \"//*[@id='single-next-link']\",\n            'required' =\u003e true\n        ),\n        array(\n            // 抽取内容页的文章作者\n            'name' =\u003e \"article_author\",\n            'selector' =\u003e \"//div[contains(@class,'author')]//h2\",\n            'required' =\u003e true\n        ),\n    ),\n);\n$spider = new phpspider($configs);\n$spider-\u003estart();\n```\n爬虫的整体框架就是这样, 首先定义了一个$configs数组, 里面设置了待爬网站的一些信息, 然后通过调用```$spider = new phpspider($configs);```和```$spider-\u003estart();```来配置并启动爬虫.\n\n#### 运行界面如下:      \n\n![](http://www.epooll.com/zhihu/pachong.gif)\n\n更多详细内容，移步到：\n\n[开发文档](http://doc.phpspider.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowner888%2Fphpspider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowner888%2Fphpspider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowner888%2Fphpspider/lists"}