{"id":18451515,"url":"https://github.com/scotow/burgoking","last_synced_at":"2025-04-19T14:02:31.762Z","repository":{"id":37620994,"uuid":"165146018","full_name":"scotow/burgoking","owner":"scotow","description":"Burger King - Free Burger Code Generator","archived":false,"fork":false,"pushed_at":"2023-10-11T21:22:18.000Z","size":225,"stargazers_count":28,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T09:56:18.158Z","etag":null,"topics":["burger","burger-king","code","food","go","golang","promotion","webscraping"],"latest_commit_sha":null,"homepage":"","language":"Go","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/scotow.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":"2019-01-10T23:22:49.000Z","updated_at":"2024-11-03T22:24:44.000Z","dependencies_parsed_at":"2024-06-19T02:48:30.307Z","dependency_job_id":"7f0e19a3-3036-48d6-8dfa-80a89b69b370","html_url":"https://github.com/scotow/burgoking","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scotow%2Fburgoking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scotow%2Fburgoking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scotow%2Fburgoking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scotow%2Fburgoking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scotow","download_url":"https://codeload.github.com/scotow/burgoking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249708961,"owners_count":21313944,"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":["burger","burger-king","code","food","go","golang","promotion","webscraping"],"created_at":"2024-11-06T07:28:55.053Z","updated_at":"2025-04-19T14:02:31.711Z","avatar_url":"https://github.com/scotow.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# burgoking\n\n⚠️ As of September 2022, Burger King migrated their survey system to a third party company, resulting to changes that require an almost complete rebuild of this project. Unfortunately, I cannot find the time nor the will to do it. So, I replaced the generation algorithm with something local and static. In almost all cases, this generator will work (I never encountered a BK employee that checked the numbers). ⚠️\n\n🍔 **Burger King - Free Burger Code Generator** 🍔\n\nGenerate a Burger King's promotion code to get a free burger using Golang.\n\n\n### Installation\n\n`$ go get github.com/scotow/burgoking`\n\n\n### Examples\n\n\n#### Library\n\nThe library provides two ways to generate codes. A single code can be generating or an auto refreshing pool can be used.\n\n\n##### Generating a single code\n\n```go\nfunc GenerateCode(meal *Meal) (code string, err error)\n```\n\nThe `meal` argument is used to fill the first page of the survey.\n\n```go\ntype Meal struct {\n\tRestaurant int\n\tDate       time.Time\n}\n```\n\nPassing `nil` as an argument generate a random meal using the `func RandomMeal() *Meal` function.\n\n##### Using a pool of codes\n\nA pool of codes holds a fixed amount of codes. When a code of the pool is consumed by the function `GetCode`, a new goroutine is spawned to generate a new code.\n\nAn expiration duration can be specified. When a code has stayed in the pool for too long, a timer removes it from the pool and a new generation is launched.\n\nTo create a new pool, you may call the following function:\n\n```go\nfunc NewPool(size int, expiration, retry time.Duration) (pool *Pool, err error)\n```\n\nWhere\n* `size` is the total number of codes in the pool.\n* `expiration` is the duration required for a code to be remove and auto re-generated.\n* `retry` is the duration required between two calls of the `GenerateCode` function if the first call failed for any reason. This prevents the pool from spaming the website.\n\n#### Binaries\n\nThe [cmd](https://github.com/Scotow/burgoking/blob/master/cmd) folder contains three examples of program that use the `burgoking` library.\n\n##### Simple code\n\nThe [code](https://github.com/Scotow/burgoking/blob/master/cmd/code) command is a simple wrapper of the library. It generates a code and prints it to `stdout`.\n\nHere are the available options:\n\n```\nUsage of code:\n  -n int\n    \tnumber of code to generate (default 1)\n  -p\t\n  \tgenerate each code on a different goroutine (default false)\n```\n\n##### Simple API\n\nThe [api](https://github.com/Scotow/burgoking/blob/master/cmd/api) command starts a simple web server that returns a new promotion code to each request.\n\n##### (Old) Web friendly server\n\nThe [web](https://github.com/Scotow/burgoking/blob/master/cmd/web_original) command is a ready-for-demo binary that serves a simple, yet beautiful UI generating promotion codes using a pool.\n\nThe program may setup a second private pool that requires a `Authorization` HTTP header.\n\nHere are the available options:\n\n```\nUsage of web:\n  -D string\n    \tprivate code expiration (default \"24h0m0s\")\n  -N int\n    \tprivate code pool size (default 1)\n  -R string\n    \tprivate code regeneration interval (default \"30s\")\n  -c string\n    \tcontact address on error\n  -d string\n    \tpublic code expiration (default \"24h0m0s\")\n  -k string\n    \tauthorization token for private and direct code (disable if empty)\n  -n int\n    \tpublic code pool size (default 3)\n  -p int\n    \tlistening port (default 8080)\n  -r string\n    \tpublic code regeneration interval (default \"30s\")\n```\n\n### Contribution\n\nFeedbacks are appreciated. Feel free to open an issue or a pull request if needed.\n\nFurthermore, if you went to a restaurant which its number isn't in the restaurants [list](https://github.com/Scotow/burgoking/blob/master/meal.go#L9), a merge request to add it is appreciated.\n\n\n### Disclaimer\n\n*burgoking* provided by *Scotow* is for illustrative purposes only which provides customers with programming information regarding the products. This software is supplied \"AS IS\" without any warranties and support.\n\nI assumes no responsibility or liability for the use of the software, conveys no license or title under any patent, copyright, or mask work right to the product.\n\n### JavaScript version\n\nA deprecated and no more maintained version of this project made with JavaScript (NodeJS) and CasperJS is availiable [here](https://github.com/Scotow/bk-generator).\n\n***Enjoy your meal!***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscotow%2Fburgoking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscotow%2Fburgoking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscotow%2Fburgoking/lists"}