{"id":14971213,"url":"https://github.com/justinwoo/purescript-toppokki","last_synced_at":"2026-03-02T11:31:20.767Z","repository":{"id":30531620,"uuid":"125277119","full_name":"justinwoo/purescript-toppokki","owner":"justinwoo","description":"A binding to puppeteer to drive headless Chrome.","archived":false,"fork":false,"pushed_at":"2022-05-16T11:47:55.000Z","size":126,"stargazers_count":50,"open_issues_count":2,"forks_count":21,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-30T03:40:41.197Z","etag":null,"topics":["headless-chrome","puppeteer","purescript"],"latest_commit_sha":null,"homepage":"https://pursuit.purescript.org/packages/purescript-toppokki","language":"PureScript","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/justinwoo.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-03-14T21:42:42.000Z","updated_at":"2026-01-19T13:41:45.000Z","dependencies_parsed_at":"2022-07-28T02:46:53.650Z","dependency_job_id":null,"html_url":"https://github.com/justinwoo/purescript-toppokki","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/justinwoo/purescript-toppokki","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-toppokki","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-toppokki/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-toppokki/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-toppokki/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinwoo","download_url":"https://codeload.github.com/justinwoo/purescript-toppokki/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinwoo%2Fpurescript-toppokki/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30000029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T11:09:27.951Z","status":"ssl_error","status_checked_at":"2026-03-02T11:08:53.255Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["headless-chrome","puppeteer","purescript"],"created_at":"2024-09-24T13:44:51.996Z","updated_at":"2026-03-02T11:31:20.729Z","avatar_url":"https://github.com/justinwoo.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PureScript-Toppokki\n\nA binding to [puppeteer](https://github.com/GoogleChrome/puppeteer) to drive headless Chrome.\n\nThis module is \"incomplete\" (but useful for regular work projects), and you can help by submitting PRs. You may find that `goto`, `pageWaitForSelector`, `click`, and `unsafeEvaluateStringFunction` already provide the functionality you need.\n\nNamed for glorious Tteok-bokki.\n\n![](https://i.imgur.com/KPSU9lY.png)\n\n## Usage\n\nMake sure [Puppeteer](https://github.com/GoogleChrome/puppeteer) is installed (e.g. `npm i puppeteer`).\n\n```hs\nmodule Main where\n\nimport Toppokki as T\nimport Prelude (bind, discard, (\u003e))\nimport Effect.Aff (launchAff_)\nimport Test.Unit.Assert as Assert\nimport Data.String as String\n\nmain = launchAff_ do\n  browser \u003c- T.launch {}\n  page \u003c- T.newPage browser\n  T.goto (T.URL \"https://example.com\") page\n  content \u003c- T.content page\n  Assert.assert \"content is non-empty string\" (String.length content \u003e 0)\n  _ \u003c- T.screenshot {path: \"./test/test.png\"} page\n  _ \u003c- T.pdf {path: \"./test/test.pdf\"} page\n  T.close browser\n```\n\n## More examples\n\nYou might also find this example from the [vidtracker](https://github.com/justinwoo/vidtracker/blob/37c511ed82f209e0236147399e8a91999aaf754c/src/GetIcons.purs) project useful:\n\n```hs\ndownloadIconIfNotExist :: T.Browser -\u003e Set String -\u003e String -\u003e Aff Unit\ndownloadIconIfNotExist browser existing name =\n  unless (member name existing) do\n    page \u003c- T.newPage browser\n    let\n      name' = S.replace (S.Pattern \" \") (S.Replacement \"+\") name\n      pageURL = \"https://duckduckgo.com/?iax=images\u0026ia=images\u0026q=\" \u003c\u003e name' \u003c\u003e \"+anime+wiki\"\n    T.goto (T.URL pageURL) page\n    _ \u003c- T.pageWaitForSelector (T.Selector \".tile--img__img\") {} page\n    result \u003c- T.unsafeEvaluateStringFunction \"document.querySelector('.tile--img__img').src\" page\n    case JSON.read result of\n      Right (url :: String) -\u003e do\n        log $ \"downloading from \" \u003c\u003e url\n        curl url (iconsPath \u003c\u003e \"/\" \u003c\u003e name)\n        pure unit\n      Left e -\u003e do\n        log $ \"could not handle \" \u003c\u003e name \u003c\u003e \" with url \" \u003c\u003e pageURL\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinwoo%2Fpurescript-toppokki","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinwoo%2Fpurescript-toppokki","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinwoo%2Fpurescript-toppokki/lists"}