{"id":16968461,"url":"https://github.com/squallstar/xpath-articles-rules","last_synced_at":"2026-04-29T00:03:39.474Z","repository":{"id":19737194,"uuid":"22993635","full_name":"squallstar/xpath-articles-rules","owner":"squallstar","description":"A collection of xpath rules to extract relevant content from popular websites.","archived":false,"fork":false,"pushed_at":"2014-09-11T10:39:35.000Z","size":160,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T13:13:01.649Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/squallstar.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":"2014-08-15T15:16:54.000Z","updated_at":"2014-08-15T15:45:02.000Z","dependencies_parsed_at":"2022-07-12T15:17:25.303Z","dependency_job_id":null,"html_url":"https://github.com/squallstar/xpath-articles-rules","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squallstar%2Fxpath-articles-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squallstar%2Fxpath-articles-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squallstar%2Fxpath-articles-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squallstar%2Fxpath-articles-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squallstar","download_url":"https://codeload.github.com/squallstar/xpath-articles-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244844531,"owners_count":20519790,"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-14T00:12:08.730Z","updated_at":"2026-04-29T00:03:39.431Z","avatar_url":"https://github.com/squallstar.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# XPath Articles rules\n\nA collection of xpath rules to extract relevant content from popular websites.\n\n\nHere's an example about how to use it in PHP:\n\n    \u003c?php\n    \n    $rules = json_decode(file_get_contents('rules.json'), true)];\n    \n    $url = 'http://www.theverge.com/2014/8/14/6001153/the-best-fitness-tracker-you-can-buy';\n    \n    $html = file_get_contents($url);\n    \n    libxml_use_internal_errors(true);\n    \n    $doc = new DOMDocument;\n    $doc-\u003eloadHTML($html);\n    \n    $xpath = new DOMXPath($doc);\n    \n    $image = $xpath-\u003equery($rules['common']['image])-\u003eitem(0)-\u003etextContent;\n    \n    $host = parse_uri($url)['host];\n    $article_nodes = $xpath-\u003equery($rules['hosts'][$host]['content]);\n    \n    if ($article_nodes-\u003elength \u003e 0)\n    {        \n      $article_node = $article_nodes-\u003eitem(0);\n      $article_text = $article_node-\u003eownerDocument-\u003esaveHTML($article_node);\n    }\n    \net voilà !","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquallstar%2Fxpath-articles-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquallstar%2Fxpath-articles-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquallstar%2Fxpath-articles-rules/lists"}