{"id":22108878,"url":"https://github.com/theadnan/webscraper","last_synced_at":"2025-03-24T03:43:35.667Z","repository":{"id":79678445,"uuid":"111701925","full_name":"TheAdnan/webscraper","owner":"TheAdnan","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-16T07:28:40.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T09:49:24.759Z","etag":null,"topics":["devtools-extension","firefox","webextension","webextensions","webextensions-apis","webscraper","webscraping"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheAdnan.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-22T15:34:18.000Z","updated_at":"2022-11-16T07:26:14.000Z","dependencies_parsed_at":"2023-05-14T12:00:22.898Z","dependency_job_id":null,"html_url":"https://github.com/TheAdnan/webscraper","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/TheAdnan%2Fwebscraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAdnan%2Fwebscraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAdnan%2Fwebscraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAdnan%2Fwebscraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheAdnan","download_url":"https://codeload.github.com/TheAdnan/webscraper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245206459,"owners_count":20577578,"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":["devtools-extension","firefox","webextension","webextensions","webextensions-apis","webscraper","webscraping"],"created_at":"2024-12-01T09:20:53.285Z","updated_at":"2025-03-24T03:43:35.641Z","avatar_url":"https://github.com/TheAdnan.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webscraper\n\nSimple CSS selector JSON definition to extract data from HTML sites.\nUnderlying it uses Jsoup.\n\nSample\n\n````\n\n// get html using HTTP Client or load from String\nString html = getHtml(...)\n\n// get definition from Resource path or construct the Map\u003cString,Object\u003e();\nMap\u003cString,Object\u003e def = getDefinition(path);\n\nIWebScraperExtractor webExtractor = new WebScraperJsoupExtractorImpl();\n\n// this will return extracted values as Map\nMap\u003cString,Object\u003e m = webExtractor.run(html);\n\n````\n\nSample definition extractor for landing page Wikipedia https://www.wikipedia.org/\n\n````\n{\n  \"selectors\": [\n    {\n      \"key\":\"langs\",\n      \"type\":\"container\",\n      \"css\":\".central-featured .central-featured-lang\",\n      \"items\":[\n        {\n          \"key\":\"title\",\n          \"type\":\"item\",\n          \"css\":\".link-box strong\",\n          \"attr\":\"text\"\n        },\n        {\n          \"key\":\"url\",\n          \"type\":\"item\",\n          \"css\":\"a\",\n          \"attr\":\"href\"\n        }\n      ]\n    },\n    {\n      \"key\":\"otherProjects\",\n      \"type\":\"container\",\n      \"css\":\".other-projects .other-project\",\n      \"items\":[\n        {\n          \"key\":\"title\",\n          \"type\":\"item\",\n          \"css\":\".other-project-title\",\n          \"attr\":\"text\"\n        },\n        {\n          \"key\":\"url\",\n          \"type\":\"item\",\n          \"css\":\"a\",\n          \"attr\":\"href\"\n        }\n      ]\n    }\n  ]\n}\n\n````\nSample output (JSON):\n\n````\n{\n  \"langs\": [\n    {\n      \"title\": \"English\",\n      \"url\": \"//en.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Español\",\n      \"url\": \"//es.wikipedia.org/\"\n    },\n    {\n      \"title\": \"日本語\",\n      \"url\": \"//ja.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Deutsch\",\n      \"url\": \"//de.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Русский\",\n      \"url\": \"//ru.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Français\",\n      \"url\": \"//fr.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Italiano\",\n      \"url\": \"//it.wikipedia.org/\"\n    },\n    {\n      \"title\": \"中文\",\n      \"url\": \"//zh.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Português\",\n      \"url\": \"//pt.wikipedia.org/\"\n    },\n    {\n      \"title\": \"Polski\",\n      \"url\": \"//pl.wikipedia.org/\"\n    }\n  ],\n  \"otherProjects\": [\n    {\n      \"title\": \"Commons\",\n      \"url\": \"//commons.wikimedia.org/\"\n    },\n    {\n      \"title\": \"Wikivoyage\",\n      \"url\": \"//www.wikivoyage.org/\"\n    },\n    {\n      \"title\": \"Wiktionary\",\n      \"url\": \"//www.wiktionary.org/\"\n    },\n    {\n      \"title\": \"Wikibooks\",\n      \"url\": \"//www.wikibooks.org/\"\n    },\n    {\n      \"title\": \"Wikinews\",\n      \"url\": \"//www.wikinews.org/\"\n    },\n    {\n      \"title\": \"Wikidata\",\n      \"url\": \"//www.wikidata.org/\"\n    },\n    {\n      \"title\": \"Wikiversity\",\n      \"url\": \"//www.wikiversity.org/\"\n    },\n    {\n      \"title\": \"Wikiquote\",\n      \"url\": \"//www.wikiquote.org/\"\n    },\n    {\n      \"title\": \"MediaWiki\",\n      \"url\": \"//www.mediawiki.org/\"\n    },\n    {\n      \"title\": \"Wikisource\",\n      \"url\": \"//www.wikisource.org/\"\n    },\n    {\n      \"title\": \"Wikispecies\",\n      \"url\": \"//species.wikimedia.org/\"\n    },\n    {\n      \"title\": \"Meta-Wiki\",\n      \"url\": \"//meta.wikimedia.org/\"\n    }\n  ]\n}\n\n````\n\n\nPlease check Tests for other samples...","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheadnan%2Fwebscraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheadnan%2Fwebscraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheadnan%2Fwebscraper/lists"}