{"id":29604289,"url":"https://github.com/nandoflorestan/livid","last_synced_at":"2025-07-20T15:05:49.979Z","repository":{"id":303338667,"uuid":"1015141038","full_name":"nandoflorestan/livid","owner":"nandoflorestan","description":"URL-friendly IDs for your app, like YouTube's","archived":false,"fork":false,"pushed_at":"2025-07-08T11:07:25.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-08T12:25:21.850Z","etag":null,"topics":["guid","ids","python-library","uuid","youtube-ids"],"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/nandoflorestan.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,"zenodo":null}},"created_at":"2025-07-07T04:22:10.000Z","updated_at":"2025-07-08T11:07:23.000Z","dependencies_parsed_at":"2025-07-08T12:25:36.931Z","dependency_job_id":null,"html_url":"https://github.com/nandoflorestan/livid","commit_stats":null,"previous_names":["nandoflorestan/yid","nandoflorestan/livid"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nandoflorestan/livid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nandoflorestan%2Flivid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nandoflorestan%2Flivid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nandoflorestan%2Flivid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nandoflorestan%2Flivid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nandoflorestan","download_url":"https://codeload.github.com/nandoflorestan/livid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nandoflorestan%2Flivid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266144075,"owners_count":23883109,"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":["guid","ids","python-library","uuid","youtube-ids"],"created_at":"2025-07-20T15:05:45.207Z","updated_at":"2025-07-20T15:05:49.966Z","avatar_url":"https://github.com/nandoflorestan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Raison d'etre\n\nGUID and UUID are not good ID schemes for the web because they are not designed for human consumption.\nThey are too long and too hard to type, therefore not adequate for a URL.\nYoutube solved this problem perfectly with their 11-character video IDs, which:\n\n- are short,\n- are as easy to type as is realistic to hope for, and\n- contain a lot of information in them.\n\nNow you wish to use the same scheme in your application.\n\n- Below is a specification. It is identical to what YouTube does, as far as we know. Let us call it \"Livid\".\n- This project contains implementations of the spec:\n    - in Dart (TODO)\n    - in Javascript (TODO)\n    - in Python\n\n## Livid specification\n\n### Length and alphabet\n\n* **11 characters** long (commonly constant, though not formally guaranteed) ([webapps.stackexchange.com][1]).\n* Characters drawn from a **URL-safe Base64** set `A–Z a–z 0–9 - _` (64 possibilities) ([webapps.stackexchange.com][1]).\n\n### Bit structure and payload\n\n* Encodes a **64-bit integer** payload.\n* 11 Base64 characters ≈ 66 bits; only about **64 bits** carry payload.\n* The **last character** is restricted to 16 possible values to zero out unused bits.\n\nThe regular expression pattern for valid IDs is `[A-Za-z0-9_-]{10}[AEIMQUYcgkosw048]`.\n\n### Encoding process\n\n1. Generate a **random 64-bit unsigned integer**.\n2. Encode in Base64, producing an 11-character string.\n   - Standard Base64 uses `+/`; we replace `/` with `-` and `+` with `_` for URL safety.\n   - No padding (`=`) is used, as the length is fixed ([stackoverflow.com][2], [wiki.archiveteam.org][3], [webapps.stackexchange.com][1]).\n3. If the integer collides with an existing ID, regenerate. Collisions are extremely rare in such a large space.\n\n### Collision and randomness strategy\n\n- IDs are **randomly generated**, not sequential, to avoid enumeration, scraping, and privacy leaks ([reddit.com][4]).\n- Collision-checking ensures uniqueness.\n\n### Validity and guaranteed uniqueness\n\n- Though the 11-char format is stable, there's **no official commitment** to keep it permanently ([webapps.stackexchange.com][1]).\n- To validate or test an ID, you must query the existing data ([webapps.stackexchange.com][1]).\n\n---\n\n### Summary table\n\n| Feature                   | Description                               |\n| ------------------------- | ----------------------------------------- |\n| **Length**                | Exactly 11 chars                          |\n| **Character set**         | `[A–Z][a–z][0–9][- _]`                    |\n| **Encoded data**          | 64-bit + 2 unused bits                    |\n| **End-char restrictions** | Only 16 values (last 2 bits zeroed)       |\n| **Generation method**     | Random + Base64 URL-safe encoding         |\n| **Collision handling**    | Check uniqueness, retry on conflict       |\n| **Validation**            | Query the server/API                  |\n| **Guarantee**             | No official guarantee on format stability |\n\n---\n\n[1]: https://webapps.stackexchange.com/questions/54443/format-for-id-of-youtube-video?utm_source=chatgpt.com \"Format for ID of YouTube video - Web Applications Stack Exchange\"\n[2]: https://stackoverflow.com/questions/73276694/youtube-video-id-algorithm?utm_source=chatgpt.com \"YouTube Video ID Algorithm - javascript - Stack Overflow\"\n[3]: https://wiki.archiveteam.org/index.php/YouTube/Technical_details?utm_source=chatgpt.com \"YouTube/Technical details - Archiveteam\"\n[4]: https://www.reddit.com/r/learnprogramming/comments/gx0jvr/how_does_youtube_manages_video_ids_how_to/?utm_source=chatgpt.com \"How does YouTube manages video IDs? How to replicate ... - Reddit\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnandoflorestan%2Flivid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnandoflorestan%2Flivid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnandoflorestan%2Flivid/lists"}