{"id":17246260,"url":"https://github.com/hanson/crawler","last_synced_at":"2025-04-14T04:35:44.961Z","repository":{"id":62514376,"uuid":"59142121","full_name":"Hanson/crawler","owner":"Hanson","description":"A easy package to crawl a site list and detail","archived":false,"fork":false,"pushed_at":"2018-06-30T03:20:48.000Z","size":29,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-14T21:28:11.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Hanson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-18T18:42:48.000Z","updated_at":"2024-03-14T21:28:11.252Z","dependencies_parsed_at":"2022-11-02T13:02:51.250Z","dependency_job_id":null,"html_url":"https://github.com/Hanson/crawler","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcrawler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcrawler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcrawler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hanson%2Fcrawler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hanson","download_url":"https://codeload.github.com/Hanson/crawler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248823928,"owners_count":21167339,"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":[],"created_at":"2024-10-15T06:32:59.065Z","updated_at":"2025-04-14T04:35:44.923Z","avatar_url":"https://github.com/Hanson.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crawler\n\nA easy package to crawl a site list and detail\n\n## Installation\n\n```\ncomposer require hanccc/crawler\n```\n\n## usage\n\nThis package require [Goutte](https://github.com/FriendsOfPHP/Goutte), you can get the dom by ```$this-\u003ecrawler();``` in both of list and detail.\n\n### example\n\n```\n        //or $listCrawler = new ExampleListCrawler(storage_path('logs'));\n        $listCrawler = new ExampleListCrawler('http://example.com', storage_path('logs'));\n        $listCrawler-\u003esetDetailCrawler(new ExampleDetailCrawler());\n        $listCrawler-\u003estart();\n```\n\n#### ListCrawler\n\n\n```\nclass ExampleListCrawler extends ListCrawler{\n    public $url = 'http://example.com';\n    \n    //return links per page\n    public function getEachPageUrl($page)\n    {\n        return 'http://example.com/list\u0026page=' . $page;\n    }\n    \n    // get the maximum number of pages\n    public function setMaxPage()\n    {\n        $this-\u003emaxPage = $num;\n    }\n}\n\n```\n\n#### DetailCrawler\n\n```\nclass ExampleDetailCrawler extends DetailCrawler{\n\n    //Returns boolean\n    public function isDetailUrl($url)\n    {\n        if(preg_match('/example.com\\/id(\\d+)/, $url))\n            return true;\n    }\n    \n    // what you want to do about the detail page\n    public function handle()\n    {\n        echo $this-\u003ecrawler-\u003efilter('title')-\u003etext();\n    }\n}\n```\n\n\n## License\n\nCrawler is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanson%2Fcrawler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanson%2Fcrawler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanson%2Fcrawler/lists"}