{"id":19298007,"url":"https://github.com/cx-lukas-salkauskas-x/Custom-String-Parser","last_synced_at":"2026-07-03T02:30:16.687Z","repository":{"id":2394577,"uuid":"3360995","full_name":"dotpot/Custom-String-Parser","owner":"dotpot","description":"Custom string data parser written in python","archived":false,"fork":false,"pushed_at":"2013-03-07T10:43:01.000Z","size":132,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-05T22:12:10.246Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/dotpot.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":"2012-02-05T17:56:48.000Z","updated_at":"2019-02-22T14:52:16.000Z","dependencies_parsed_at":"2022-09-08T02:21:02.226Z","dependency_job_id":null,"html_url":"https://github.com/dotpot/Custom-String-Parser","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/dotpot%2FCustom-String-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpot%2FCustom-String-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpot%2FCustom-String-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotpot%2FCustom-String-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotpot","download_url":"https://codeload.github.com/dotpot/Custom-String-Parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400338,"owners_count":19795332,"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-11-09T23:06:40.768Z","updated_at":"2026-07-03T02:30:16.589Z","avatar_url":"https://github.com/dotpot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eCustom String Parser\u003c/h1\u003e\n\n\u003cp\u003eYou can use this component if you need to parse any information from any string value which has some \u003ca href=\"http://en.wikipedia.org/wiki/Syntax_(logic)\"\u003esyntax logics.\u003c/a\u003e\u003c/p\u003e\n\n\u003cblockquote\u003e\u003cp\u003eThe easiest way to parse data from string in python.\u003c/p\u003e\u003c/blockquote\u003e\n\n\u003ch2\u003eOverview\u003c/h2\u003e\n\n\u003cp\u003e\u003cstrong\u003eCustomStringParser\u003c/strong\u003e, the missing simple string parser for \u003cem\u003epython developers\u003c/em\u003e.\u003c/p\u003e\n\n\u003ch3\u003eUsage\u003c/h3\u003e\n\n\u003ch4\u003eParsing HTML\u003c/h4\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote: for html based parsing you should consider using \u003ca href=\"http://www.w3schools.com/xpath/\"\u003expath\u003c/a\u003e\n\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003eImagine you have this kind of content in your \u003ccode\u003estring_data\u003c/code\u003e with this content:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"section-item\"\u0026gt;\n    \u0026lt;div class=\"section-title\"\u0026gt;\n        title1\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        15\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u0026lt;/div\u0026gt; \u0026lt;!--end section-item--\u0026gt;\n\u0026lt;div class=\"section-item\"\u0026gt;\n    \u0026lt;div class=\"section-title\"\u0026gt;\n        title2\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        16\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u0026lt;/div\u0026gt; \u0026lt;!--end section-item--\u0026gt;\n\u0026lt;div class=\"section-item\"\u0026gt;\n    \u0026lt;div class=\"section-title\"\u0026gt;\n            title3\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        17\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u0026lt;/div\u0026gt; \u0026lt;!--end section-item--\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003eWe need to parse these items:\u003c/p\u003e\n\n\u003cul\u003e\n\u003cli\u003etitle\u003c/li\u003e\n\u003cli\u003ecomments count\u003c/li\u003e\n\u003c/ul\u003e\n\n\n\u003cp\u003eCode to parse this looks like this:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eparser = CustomStringParserCore(string_data)\nitem_parser = ParsingNode('item', '\u0026lt;div class=\"section-item\"\u0026gt;', '\u0026lt;/div\u0026gt; \u0026lt;!--end section-item--\u0026gt;')\n\ntitle_parser = ParsingNode('title', '\u0026lt;div class=\"section-title\"\u0026gt;', '\u0026lt;/div\u0026gt; \u0026lt;!-- end section title --\u0026gt;')\ncomments_parser = ParsingNode('comments', '\u0026lt;div class=\"section-comments\"\u0026gt;', '\u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;')\n# note: our item result will have title and comments inside of it, so we can do this:\nitem_parser.add_parser(title_parser)\nitem_parser.add_parser(comments_parser)\n\n# add main parser to the parsing core\nparser.add_parser(item_parser)\n\n# call the parse\nparser.parse()\n\n\u0026lt;..\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cstrong\u003eoutput (print_results(item_parser.results)):\u003c/strong\u003e\u003c/p\u003e\n\n\u003cp\u003e\u003cem\u003eitem\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"section-title\"\u0026gt;\n        title1\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        15\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003etitle\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etitle1\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003ecomments\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e15\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003eitem\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"section-title\"\u0026gt;\n        title2\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        16\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003etitle\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etitle2\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003ecomments\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e16\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003eitem\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\u0026lt;div class=\"section-title\"\u0026gt;\n            title3\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-title --\u0026gt;\n    \u0026lt;div class=\"section-comments\"\u0026gt;\n        17\n    \u0026lt;/div\u0026gt; \u0026lt;!-- end section-comments --\u0026gt;\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003etitle\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003etitle3\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cp\u003e\u003cem\u003ecomments\u003c/em\u003e:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e17\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch4\u003eThis is very generic, so you can parse practically any structure.\u003c/h4\u003e\n\n\u003ch3\u003eUnit tests\u003c/h3\u003e\nThis library suppose to be fully unit tested. So if you want to participate keep that in mind.\n\n\u003ch3\u003eFeature ideas ( not yet implemented )\u003c/h3\u003e\n* Regex based parsers possibility.\n* Grouped regex based parsers possibility.\n* XPath based parsers possibility.\n* Filtering out results by parser name.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcx-lukas-salkauskas-x%2FCustom-String-Parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcx-lukas-salkauskas-x%2FCustom-String-Parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcx-lukas-salkauskas-x%2FCustom-String-Parser/lists"}