{"id":15908702,"url":"https://github.com/capjamesg/screenshots","last_synced_at":"2025-03-22T03:31:32.401Z","repository":{"id":104874137,"uuid":"593797604","full_name":"capjamesg/screenshots","owner":"capjamesg","description":"A service to serve meta images for my personal website.","archived":false,"fork":false,"pushed_at":"2024-05-02T07:03:16.000Z","size":251,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T07:43:11.766Z","etag":null,"topics":["puppeteer","screenshots"],"latest_commit_sha":null,"homepage":"https://screenshots.jamesg.blog","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit-0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/capjamesg.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T21:24:51.000Z","updated_at":"2023-09-02T10:46:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"22150612-1e52-4acf-8980-26f2e29cf0d5","html_url":"https://github.com/capjamesg/screenshots","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/capjamesg%2Fscreenshots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fscreenshots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fscreenshots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/capjamesg%2Fscreenshots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/capjamesg","download_url":"https://codeload.github.com/capjamesg/screenshots/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902929,"owners_count":20529114,"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":["puppeteer","screenshots"],"created_at":"2024-10-06T14:23:31.502Z","updated_at":"2025-03-22T03:31:31.886Z","avatar_url":"https://github.com/capjamesg.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Screenshots\n\nAn application that, given a URL, will take a screenshot of the page and save it to a file.\n\n## Example Screenshot\n\n![The /coffee/ page on jamesg.blog](example.png)\n\n## Usage\n\nTo request a screenshot of a page, make a GET request to the application with the URL of the page you want to screenshot as the `url` parameter:\n\n    GET /?url=https://jamesg.blog\n\nThis will return an image file of the top of the viewport.\n\n## Process\n\nWhen a request is received, this application:\n\n1. Validates the URL to make sure the host name is in an allowed list of domains.\n2. Checks if a screenshot of the page has already been taken.\n3. If a screenshot has already been taken, it is returned.\n4. If a screenshot has not been taken, the page is loaded in a headless browser and a screenshot is taken.\n5. The screenshot is saved to a file.\n6. The screenshot is returned to the user.\n\nThis application uses [Puppeteer](https://pptr.dev/) to take the screenshot.\n\n## Installation\n\nTo install this project, clone the repository and run `npm install`:\n\n    git clone https://github.com/capjamesg/screenshots\n    cd screenshots\n    npm install\n\nNext, set a `CACHE_CLEAR_KEY` environment variable to a secret string. This will be the key that is used to clear the cache for an image. For example:\n\n    export CACHE_CLEAR_KEY=1234567890\n\nNext, open the `screenshot.js` file and add the domains you want to allow screenshots of to the `allowedDomains` array. For example:\n\n    const allowedDomains = [\n        \"example.com\"\n    ];\n\nTo run the project, execute the following command:\n\n    node screenshot.js\n\nThis will run the project at `http://localhost:9005`.\n\n## Technologies Used\n\n- [Puppeteer](https://pptr.dev/)\n- Express\n- Node.js\n\n## License\n\nThis application is licensed under an MIT No Attribution license. See the [LICENSE](LICENSE) file for more information.\n\n## Contributors\n\n- capjamesg","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapjamesg%2Fscreenshots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapjamesg%2Fscreenshots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapjamesg%2Fscreenshots/lists"}