{"id":19169847,"url":"https://github.com/vanekjar/urlexpander","last_synced_at":"2025-09-02T13:14:00.724Z","repository":{"id":57608417,"uuid":"79055672","full_name":"vanekjar/urlexpander","owner":"vanekjar","description":"Go package providing API for expanding shortened urls from services like goo.gl, bitly.com, tinyurl.com","archived":false,"fork":false,"pushed_at":"2021-10-14T00:41:43.000Z","size":892,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T23:43:31.864Z","etag":null,"topics":["api","expanding-shortened-urls","go","golang","shortener","tinyurl"],"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/vanekjar.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":"2017-01-15T19:53:54.000Z","updated_at":"2023-05-07T03:55:17.000Z","dependencies_parsed_at":"2022-09-03T10:01:19.910Z","dependency_job_id":null,"html_url":"https://github.com/vanekjar/urlexpander","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/vanekjar%2Furlexpander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanekjar%2Furlexpander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanekjar%2Furlexpander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanekjar%2Furlexpander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanekjar","download_url":"https://codeload.github.com/vanekjar/urlexpander/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240250353,"owners_count":19771778,"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":["api","expanding-shortened-urls","go","golang","shortener","tinyurl"],"created_at":"2024-11-09T09:51:31.349Z","updated_at":"2025-02-22T23:44:25.998Z","avatar_url":"https://github.com/vanekjar.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UrlExpander\n\n[![GoDoc](https://godoc.org/github.com/vanekjar/urlexpander/lib?status.svg)](https://godoc.org/github.com/vanekjar/urlexpander/lib)\n\nGo package providing API for expanding shortened urls from services like _goo.gl, bitly.com, tinyurl.com_\n\n## Features\n\n * Translates shortened urls as fast as possible by sending lightweight HEAD request to shortening service\n * Uses local cache to handle repeated queries\n * Respects _robots.txt_ in case the shortening service must not be visited by crawlers\n\n## Usage\n\nThis project can be used either as a library from Go code or it can be used as a standalone service providing HTTP API.\n  \n### Library\n  \n```go\nimport \"github.com/vanekjar/urlexpander/lib\"\n\nexpander := urlexpander.New()\nexpanded, err := expander.ExpandUrl(\"https://goo.gl/HFoP0a\")\n```\n\n### HTTP API server\n\nInstall __UrlExpander__ locally\n \n```\ngo get github.com/vanekjar/urlexpander\n```\n\nRun command that will start a local HTTP server (listening on port 8080 by default)\n\n```bash\nurlexpander\n```\n\nCheck running server by visiting http://localhost:8080\n\n#### API description\n\n##### Request\n\n```\nGET http://urlexpander.tk/api/expand?url=https://goo.gl/HFoP0a\n```\n\n##### Response\n\n```\n200 OK\n{\"original\":\"https://goo.gl/HFoP0a\", \"expanded\":\"http://urlexpander.tk\"} \n```\n\n## Configuration\n\n```go\nconf := urlexpander.Config{\n  // Expanded urls are cached for repeated queries. Set cache capacity.\n  CacheCapacity:     cacheCapacity,\n  // Set cache expiration time in minutes.\n  CacheExpiration:   cacheExpiration,\n  // User agent string used when translating shortened url.\n  UserAgent:         userAgent,\n  // Maximum length of shortened url. It is assumed that no shortened url is longer than that.\n  ShortUrlMaxLength: 32,\n}\n\nexpander := urlexpander.NewFromConfig(conf)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanekjar%2Furlexpander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanekjar%2Furlexpander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanekjar%2Furlexpander/lists"}