{"id":15371358,"url":"https://github.com/sultaniman/pumba","last_synced_at":"2025-12-11T23:50:56.992Z","repository":{"id":38369951,"uuid":"347661488","full_name":"sultaniman/pumba","owner":"sultaniman","description":"Fetch, store and access user agent strings for different browsers","archived":false,"fork":false,"pushed_at":"2023-07-17T07:42:14.000Z","size":155,"stargazers_count":15,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T21:12:26.660Z","etag":null,"topics":["crawling","elixir","in-memory-storage","user-agent"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sultaniman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"imanhodjaev","custom":["https://www.paypal.me/SultanIman"]}},"created_at":"2021-03-14T14:36:20.000Z","updated_at":"2023-12-30T08:27:53.000Z","dependencies_parsed_at":"2024-10-16T11:41:20.556Z","dependency_job_id":"cc24764d-318c-4d2b-8fbb-cd6ec8a79873","html_url":"https://github.com/sultaniman/pumba","commit_stats":{"total_commits":66,"total_committers":4,"mean_commits":16.5,"dds":0.6060606060606061,"last_synced_commit":"f6405f5cc2c84119ca45c9115acf8bca2c7ef983"},"previous_names":["imanhodjaev/pumba"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fpumba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fpumba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fpumba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sultaniman%2Fpumba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sultaniman","download_url":"https://codeload.github.com/sultaniman/pumba/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072315,"owners_count":21208169,"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":["crawling","elixir","in-memory-storage","user-agent"],"created_at":"2024-10-01T13:46:35.393Z","updated_at":"2025-12-11T23:50:56.963Z","avatar_url":"https://github.com/sultaniman.png","language":"Elixir","funding_links":["https://github.com/sponsors/imanhodjaev","https://www.paypal.me/SultanIman"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg width=\"250\" src=\"https://raw.githubusercontent.com/imanhodjaev/pumba/main/assets/pumbaa.jpeg\"/\u003e\n\u003c/p\u003e\n\n![Tests](https://github.com/imanhodjaev/pumba/actions/workflows/pumba.yml/badge.svg)\n![Lint](https://github.com/imanhodjaev/pumba/actions/workflows/lint.yml/badge.svg)\n\nPumba helps you\n\n1. To fetch user agent strings for different browsers,\n2. Keep in-memory state,\n3. Randomly fetch any user agent,\n4. Profit - Hakuna Matata 🦄\n\n## Use cases 🔮\n\nYou might want to use `Pumba`\n\n1. To simulate real user agent when requesting website or resource,\n2. To use in tandem with crawlers to randomly swap user agent strings,\n3. Build REST API or any API on top of it or expose as a service,\n4. Many other use cases I'm not aware (open issue to share one).\n\n## Installation 💾\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `pumba` to your list of dependencies in `mix.exs` and if needed please add to\napplication list to start:\n\n```elixir\ndef deps do\n  [\n    {:pumba, \"~\u003e 0.0.2\"}\n  ]\nend\n```\n\n## Usage 🧠\n\n### Load user agents\n\nTo load user agent strings for a given browser you need to call\n\n```ex\niex\u003e Pumba.load(\"Firefox\")\n:ok\n```\n\n### Get random user agent\n\nTo load user agent strings for a given browser you need to call\n\n```ex\niex\u003e Pumba.random()\nMozilla/5.0 (X11; Linux ppc64le; rv:75.0) Gecko/20100101 Firefox/75.0\n```\n\n### Check if user agents loaded\n\n```ex\niex\u003e Pumba.ready?(\"Firefox\")\ntrue\n```\n\n### Get user agents for browser\n\n```ex\niex\u003e Pumba.get(\"Firefox\")\n[\n  \"Mozilla/5.0 (X11; Linux ppc64le; rv:75.0) Gecko/20100101 Firefox/75.0\",\n  ...\n]\n```\n\n### Set custom client\n\nDefault client fetches user agents from http://www.useragentstring.com.\n\nThere are two ways to set custom client first is via config second is overriding manually\n\nConfiguration\n\n```ex\nconfig :pumba,\n  client: MyAwesomeClient\n```\n\nRuntime\n\n```ex\niex\u003e Pumba.set_client(MyAwesomeClient)\n```\n\n### Create custom client\n\nIf you want to have your own client then it should implement `Pumba.Client` behaviour.\n\n### User agents storage\n\nStorage is a GenServer which has the following state and lives at `Pumba.UserAgents`\n\n```ex\n%{\n  client: Pumba.Client.DefaultClient,\n  browsers: %{},\n  names: []\n}\n```\n\nWhere `browsers` is a map with key as browser name and the list user agents\nas it's value, `names` is a list of loaded browsers using which we later can\nrandomly pick browser and return a random user agent.\n\n`browsers` contains `%Pumba.Result{}` record which keeps total count of user\nagents and indexed map with user agent strings for fast lookups.\n\n## Get current state\n\nTo get the latest state you can use `Pumba.all/0` function.\n\n## Documentation 📜\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/pumba](https://hexdocs.pm/pumba).\n\n## Assets 💄\n\nhttps://www.flickr.com/photos/15622979@N07/4329873905\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultaniman%2Fpumba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsultaniman%2Fpumba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsultaniman%2Fpumba/lists"}