{"id":35727348,"url":"https://github.com/wow-apps/youtube-id-py","last_synced_at":"2026-01-20T17:02:43.812Z","repository":{"id":332411893,"uuid":"1128715806","full_name":"wow-apps/youtube-id-py","owner":"wow-apps","description":"Generate YouTube-style short IDs from numbers. Lightweight, fast, and reversible base62 encoder with optional obfuscation.","archived":false,"fork":false,"pushed_at":"2026-01-13T16:46:06.000Z","size":115,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T19:55:47.694Z","etag":null,"topics":["alphanumeric","base62","encoder","hashid","id-generator","obfuscation","short-id","unique-id","url-shortener","youtube-id"],"latest_commit_sha":null,"homepage":"","language":"Python","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/wow-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-06T03:48:52.000Z","updated_at":"2026-01-06T08:26:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wow-apps/youtube-id-py","commit_stats":null,"previous_names":["wow-apps/youtube-id-py"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wow-apps/youtube-id-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wow-apps","download_url":"https://codeload.github.com/wow-apps/youtube-id-py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28485218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["alphanumeric","base62","encoder","hashid","id-generator","obfuscation","short-id","unique-id","url-shortener","youtube-id"],"created_at":"2026-01-06T09:17:21.546Z","updated_at":"2026-01-16T22:23:50.219Z","avatar_url":"https://github.com/wow-apps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTubeID for Python\n\nGenerate YouTube-style short IDs from numbers. Lightweight, fast, and reversible base62 encoder with optional obfuscation.\n\n[![PyPI version](https://badge.fury.io/py/youtube-id.svg)](https://badge.fury.io/py/youtube-id)\n[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen.svg)](https://github.com/wow-apps/yid-py)\n\n## Other programming languages\n\n- **PHP**: [kvz/youtube-id](https://github.com/kvz/youtube-id)\n- **Python**: [wow-apps/youtube-id-py](https://github.com/wow-apps/youtube-id-py/)\n- **TypeScript**: [wow-apps/youtube-id-ts](https://github.com/wow-apps/youtube-id-ts/)\n- **Go**: [wow-apps/youtube-id-go](https://github.com/wow-apps/youtube-id-go/)\n\n## Features\n\n- **Lightweight** - Zero dependencies, pure Python\n- **Fast** - Simple base62 encoding/decoding\n- **Reversible** - Encode and decode without data loss\n- **Obfuscation** - Optional secure key to shuffle the dictionary\n- **Type-safe** - Full type hints for IDE support\n\n## Installation\n\n```bash\npip install youtube-id\n```\n\nOr with Poetry:\n\n```bash\npoetry add youtube-id\n```\n\n## Quick Start\n\n```python\nimport yid_py\n\n# Encode a number to a short string\nyid_py.to_alphanumeric(12345)  # -\u003e 'dnh'\n\n# Decode back to number\nyid_py.to_numeric('dnh')  # -\u003e 12345\n```\n\n## Usage\n\n### Basic Encoding/Decoding\n\n```python\nimport yid_py\n\n# Number to alphanumeric\nyid_py.to_alphanumeric(0)        # -\u003e 'a'\nyid_py.to_alphanumeric(61)       # -\u003e 'Z'\nyid_py.to_alphanumeric(62)       # -\u003e 'ba'\nyid_py.to_alphanumeric(12345)    # -\u003e 'dnh'\nyid_py.to_alphanumeric(999999)   # -\u003e 'eGGf'\n\n# Alphanumeric to number\nyid_py.to_numeric('dnh')         # -\u003e 12345\n```\n\n### With Secure Key (Obfuscation)\n\nUse a secure key to shuffle the dictionary, making IDs harder to predict:\n\n```python\nimport yid_py\n\n# Without key\nyid_py.to_alphanumeric(12345)                      # -\u003e 'dnh'\n\n# With secure key (different output)\nyid_py.to_alphanumeric(12345, secure_key='secret') # -\u003e 'UDJ'\n\n# Decode with the same key\nyid_py.to_numeric('UDJ', secure_key='secret')      # -\u003e 12345\n```\n\n### Case Transformation\n\n```python\nfrom yid_py import to_alphanumeric, Transform\n\nto_alphanumeric(12345, transform=Transform.UPPER)  # -\u003e 'DNH'\nto_alphanumeric(12345, transform=Transform.LOWER)  # -\u003e 'dnh'\n```\n\n### Encoder Factory\n\nFor repeated operations with the same settings, use the `Encoder` class:\n\n```python\nimport yid_py\n\n# Create encoder with preset options\nenc = yid_py.create(secure_key='my-secret', transform=yid_py.Transform.UPPER)\n\n# Encode\nenc.encode(12345)      # -\u003e 'HQJ' (transformed for display)\nenc.encode_raw(12345)  # -\u003e 'hqj' (raw for storage/decoding)\n\n# Decode\nenc.decode('hqj')      # -\u003e 12345\n```\n\n## API Reference\n\n### Functions\n\n#### `to_alphanumeric(number, pad_up=0, secure_key=None, transform=Transform.NONE)`\n\nConvert a number to a short alphanumeric string.\n\n| Parameter    | Type          | Default  | Description               |\n|--------------|---------------|----------|---------------------------|\n| `number`     | `int`         | required | The number to convert     |\n| `pad_up`     | `int`         | `0`      | Padding value             |\n| `secure_key` | `str \\| None` | `None`   | Key to shuffle dictionary |\n| `transform`  | `Transform`   | `NONE`   | Case transformation       |\n\n#### `to_numeric(alphanumeric, pad_up=0, secure_key=None)`\n\nConvert an alphanumeric string back to a number.\n\n| Parameter      | Type          | Default  | Description                         |\n|----------------|---------------|----------|-------------------------------------|\n| `alphanumeric` | `str`         | required | The string to convert               |\n| `pad_up`       | `int`         | `0`      | Padding value (must match encoding) |\n| `secure_key`   | `str \\| None` | `None`   | Key (must match encoding)           |\n\n#### `create(pad_up=0, secure_key=None, transform=Transform.NONE)`\n\nCreate a reusable `Encoder` instance with preset options.\n\n### Classes\n\n#### `Encoder`\n\nReusable encoder with preset options.\n\n- `encode(number)` - Convert number to alphanumeric (with transform)\n- `encode_raw(number)` - Convert number to alphanumeric (without transform)\n- `decode(alphanumeric)` - Convert alphanumeric to number\n\n#### `Transform`\n\nEnum for case transformation:\n\n- `Transform.NONE` - No transformation\n- `Transform.UPPER` - Uppercase output\n- `Transform.LOWER` - Lowercase output\n\n## Use Cases\n\n- **URL shorteners** - Convert database IDs to short URLs\n- **Public IDs** - Hide sequential database IDs from users\n- **Share codes** - Generate readable codes for sharing\n- **Invite links** - Create short invitation tokens\n\n## Performance\n\nThe library uses base62 encoding (a-z, 0-9, A-Z) which provides:\n\n| Number Range         | Output Length |\n|----------------------|---------------|\n| 0 - 61               | 1 character   |\n| 62 - 3,843           | 2 characters  |\n| 3,844 - 238,327      | 3 characters  |\n| 238,328 - 14,776,335 | 4 characters  |\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).\n\n```bash\n# Clone and setup\ngit clone https://github.com/wow-apps/yid-py.git\ncd yid-py\npython3.10 -m venv venv\nsource venv/bin/activate\npoetry install --with dev\n\n# Run tests\npytest --cov=yid_py\n```\n\n## Credits\n\nA Python port of the YouTube-style ID generator originally created by [Kevin van Zonneveld](https://github.com/kvz) and contributors.\n\n## License\n\n[MIT](LICENSE) © Oleksii Samara, Kevin van Zonneveld\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwow-apps%2Fyoutube-id-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwow-apps%2Fyoutube-id-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwow-apps%2Fyoutube-id-py/lists"}