{"id":23069063,"url":"https://github.com/sametcodes/puppeteer-extra-plugin-replayer","last_synced_at":"2026-03-07T18:31:31.258Z","repository":{"id":50350180,"uuid":"518841091","full_name":"sametcodes/puppeteer-extra-plugin-replayer","owner":"sametcodes","description":"Replay and modify requests by intercepting network activity.","archived":false,"fork":false,"pushed_at":"2022-10-15T07:24:33.000Z","size":51,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-29T21:26:53.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/puppeteer-extra-plugin-replayer","language":"TypeScript","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/sametcodes.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":"2022-07-28T12:39:59.000Z","updated_at":"2024-07-24T10:21:00.000Z","dependencies_parsed_at":"2023-01-20T02:18:37.327Z","dependency_job_id":null,"html_url":"https://github.com/sametcodes/puppeteer-extra-plugin-replayer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sametcodes/puppeteer-extra-plugin-replayer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcodes%2Fpuppeteer-extra-plugin-replayer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcodes%2Fpuppeteer-extra-plugin-replayer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcodes%2Fpuppeteer-extra-plugin-replayer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcodes%2Fpuppeteer-extra-plugin-replayer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sametcodes","download_url":"https://codeload.github.com/sametcodes/puppeteer-extra-plugin-replayer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sametcodes%2Fpuppeteer-extra-plugin-replayer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30226246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T18:12:09.766Z","status":"ssl_error","status_checked_at":"2026-03-07T18:11:58.786Z","response_time":53,"last_error":"SSL_read: 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":[],"created_at":"2024-12-16T06:12:48.383Z","updated_at":"2026-03-07T18:31:31.233Z","avatar_url":"https://github.com/sametcodes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## puppeteer-extra-plugin-replayer\n\nReplay and modify caught requests by intercepting network activity within puppeteer scripts.\n\n\u003cimg width=\"600\" alt=\"Screen Shot 2022-10-15 at 10 13 12 AM\" src=\"https://user-images.githubusercontent.com/9467273/195974289-68ebdb69-f7dc-44c4-a747-3b33f3da645e.png\"\u003e\n\nThis package is prepared for:\n\n- QA Engineers\n- Reverse Engineers\n- Scrapers\n- Penetration Testers\n\n### Installation\n\n```npm\nnpm install puppeteer-extra-plugin-replayer\n```\n\n### How to use\n\nThere are two scenarios to catch ongoing requests:\n- initial requests when the site opens\n- requests are triggered by user actions such as mouse click or search\n\nIn the first scenario, the page initiating must be done in the trigger function.\n\n```javascript\n(async () =\u003e {\n    const request = await page.catchRequest({\n        pattern: /hashflags.json/\n    }, () =\u003e page.goto(\"https://twitter.com\"));\n\n    const response = await request.replay();\n})();\n```\n\nIn the second scenario, the interaction function that triggers the wanted request must be called in the trigger function of the `catchReques` method.\n\n```javascript\n(async () =\u003e {\n    await page.goto(\"https://twitter.com\")\n\n    //...\n\n    const request = await page.catchRequest({\n        pattern: /onboarding\\/task\\.json\\?flow_name=login/\n    }, async () =\u003e {\n        await page.waitForSelector(\"a[href='/login']\")\n        await page.click(\"a[href='/login']\")\n    });\n\n    await request.replay();\n})();\n```\n\nIt's possible to modify requests. [See more](#requestreplayrequestinit).\n\n```javascript\nconst response = await request.replay({\n\turl: \"https://twitter.com/logout\", // defining a new URL is possible\n\tmethod: \"POST\", // changing the request method is possible as well\n \tbody: JSON.stringify({test: true}),\n\theaders: {test: true},\n});\n\n// or define callback functions to read default values\n\nconst response = await request.replay({\n\turl: url =\u003e url.replace(/login/, \"/logout\"),\n\tmethod: \"POST\", // changing the request method is possible as well\n \tbody: body =\u003e body + \";test=true\",\n\theaders: headers =\u003e {...headers, test: true}\n});\n```\n\nYou can see original and replayed requests on the network tab in CDP.\n\n\u003cimg width=\"675\" alt=\"Screen Shot 2022-10-11 at 9 40 24 AM\" src=\"https://user-images.githubusercontent.com/9467273/195022533-cc08c0c6-b9e1-45de-8289-8278edc132bf.png\"\u003e\n\n\n## API\n\n#### `page.catchRequest(PatternObject, triggerFunction)`\n\nThe plugin provides a function as `.catchRequest(PatternObject, triggerFunction)`, which can be used to catch ongoing requests. The function returns an extended version of [`HTTPRequest`](https://learn.microsoft.com/en-us/javascript/api/@aspnet/signalr/httprequest?view=signalr-js-latest) object, which includes `.replay()` method.\n\n#### `request.replay(RequestInit?)`\n\nThe `.replay()` method takes an optional argument as an extended version of [`RequestInit`](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.requestinit.html) object that includes functionated version of strign parameters such `url`, `method` and `headers`, and `body`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcodes%2Fpuppeteer-extra-plugin-replayer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsametcodes%2Fpuppeteer-extra-plugin-replayer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsametcodes%2Fpuppeteer-extra-plugin-replayer/lists"}