{"id":19055783,"url":"https://github.com/taskrabbit/shrinker","last_synced_at":"2025-08-22T23:19:53.977Z","repository":{"id":5626200,"uuid":"6834164","full_name":"taskrabbit/shrinker","owner":"taskrabbit","description":"Shrink urls inside a text and store those urls inside a backend.","archived":false,"fork":false,"pushed_at":"2015-03-26T22:05:38.000Z","size":297,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-01-02T11:27:12.045Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/taskrabbit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-23T23:03:13.000Z","updated_at":"2019-09-11T22:02:11.000Z","dependencies_parsed_at":"2022-07-07T11:04:08.918Z","dependency_job_id":null,"html_url":"https://github.com/taskrabbit/shrinker","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/taskrabbit%2Fshrinker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskrabbit%2Fshrinker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskrabbit%2Fshrinker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taskrabbit%2Fshrinker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taskrabbit","download_url":"https://codeload.github.com/taskrabbit/shrinker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240111983,"owners_count":19749572,"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":[],"created_at":"2024-11-08T23:47:01.000Z","updated_at":"2025-02-22T01:24:53.358Z","avatar_url":"https://github.com/taskrabbit.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shrinker\n\nReplace all occurence of a domain and create a shortened link using a token.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'shrinker'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install shrinker\n\n## Usage\n\n\n```ruby\nShrinker.configure do\n  backend 'Redis'\n  backend_options client: {port: 6388, host: '192.168.12.22'}, expires_in: 2.weeks # or connection: Redis.current\n  expanded_domain /(www.)?google.com/ # this also works with protocol\n  exclude_path /assets|images/\n  anchors\\_only\\_in_html true         # With the mime only replace the links inside an anchor\n  shrinked_domain 'go.com'\nend\n```\n\nNot shrinking a link `www.google.com?shrinker=false\u0026something=else` would be replaced by `www.google.com?something=else`.\n\nUsage on a text:\n\n```ruby\n\ntext = \u003c\u003c-EV\n  Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n  Nunc quis rutrum http://www.google.com?something=true\u0026else=false dolor.\n  Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.\n  Curabitur ullamcorper nisl non dolor http://google.fr?something=true venenatis consequat.\n  Morbi odio libero, tincidunt quis tempus a, fringilla vitae augue.\n  http://google.com/somepath?something=true\n  Aenean placerat ullamcorper lorem vel feugiat.\nEV\n\n\nnew_text = Shrinker::Parser::Text.replace(text, {:user_id =\u003e 123})\n\nnew_text # =\u003e\n# Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n# Nunc quis rutrum http://go.com/token1 dolor.\n# Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.\n# Curabitur ullamcorper nisl non dolor http://google.fr?something=true venenatis consequat.\n# Morbi odio libero, tincidunt quis tempus a, fringilla vitae augue.\n# http://go.com/token2\n# Aenean placerat ullamcorper lorem vel feugiat.\n\n```\n\nWith a MIME:\n\n```ruby\nnew_mime = Shrinker::Parser::Mime.replace(mime, {:user_id =\u003e 123})\n```\n\nGet back a real link:\n\n```ruby\nurl = Shrinker::unshrink(token)\nurl.to_s # =\u003e 'http://google.com/something=true'\nurl.attributes['user_id'] # =\u003e 123\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskrabbit%2Fshrinker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskrabbit%2Fshrinker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskrabbit%2Fshrinker/lists"}