{"id":19248278,"url":"https://github.com/anshu-krishna/html-scraper","last_synced_at":"2025-07-13T04:37:21.447Z","repository":{"id":62486049,"uuid":"157857829","full_name":"anshu-krishna/HTML-Scraper","owner":"anshu-krishna","description":"A PHP class to simplify data extraction from HTML.","archived":false,"fork":false,"pushed_at":"2023-01-23T16:28:47.000Z","size":56,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T12:45:44.123Z","etag":null,"topics":["html-scraper","html-scraping","php","php-queryselector","scraper","web-scraper","web-scraping"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/anshu-krishna.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":"2018-11-16T11:23:40.000Z","updated_at":"2023-06-02T21:27:22.000Z","dependencies_parsed_at":"2023-02-13T01:01:15.495Z","dependency_job_id":null,"html_url":"https://github.com/anshu-krishna/HTML-Scraper","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/anshu-krishna/HTML-Scraper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FHTML-Scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FHTML-Scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FHTML-Scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FHTML-Scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anshu-krishna","download_url":"https://codeload.github.com/anshu-krishna/HTML-Scraper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FHTML-Scraper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265089719,"owners_count":23709763,"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":["html-scraper","html-scraping","php","php-queryselector","scraper","web-scraper","web-scraping"],"created_at":"2024-11-09T18:07:12.596Z","updated_at":"2025-07-13T04:37:21.427Z","avatar_url":"https://github.com/anshu-krishna.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML Scraper\nA set of PHP classes to simplify data extraction from HTML.\n\n### Installation\n```\ncomposer require anshu-krishna/html-scraper\n```\n\n---\n\n\u003eBase code for the *CSS_to_Xpath* method in *HTMLScraper* was cloned from [https://github.com/zendframework/zend-dom](https://github.com/zendframework/zend-dom).  \n\u003eZend Framework\n\u003e: [http://framework.zend.com/](http://framework.zend.com/)  \n\u003eRepository\n\u003e: [http://github.com/zendframework/zf2](http://github.com/zendframework/zf2)  \n\u003eCopyright (c) 2005-2015 Zend Technologies USA Inc. [http://www.zend.com](http://www.zend.com)  \n\u003eLicense\n\u003e: [https://framework.zend.com/license](https://framework.zend.com/license) New BSD License\n---\n\nFor *basic* documentation see the DOC file.\n\n### Example\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse Krishna\\DOMNodeHelper;\nuse Krishna\\HTMLScraper;\n\nconst TrimmedText = HTMLScraper::Extract_textContentTrim;\n\n$doc = new HTMLScraper();\n\nif(!$doc-\u003eload_HTML_file('https://www.royalroad.com/fiction/10073/the-wandering-inn')) {\n\techo 'Unable to load data';\n\texit(1);\n}\n\n$data = [];\n\n$data['title'] = $doc-\u003equerySelector_extract(TrimmedText, 'div.fic-title h1[property=\"name\"]', 0);\n\n$data['url'] = $doc-\u003expath_extract(function($meta) {\n\treturn $meta-\u003egetAttribute('content');\n}, '//meta[@property=\"og:url\"]', 0);\n\n$data['description'] = htmlspecialchars($doc-\u003equerySelector_extract(function(\u0026$div) {\n\treturn trim(DOMNodeHelper::innerHTML($div));\n}, 'div.description div[property=\"description\"]', 0));\n\n$data['tags'] = $doc-\u003equerySelector_extract(TrimmedText, 'span.tags span[property=\"genre\"]');\n\nvar_dump($data);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshu-krishna%2Fhtml-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanshu-krishna%2Fhtml-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshu-krishna%2Fhtml-scraper/lists"}