Skip to content

Comments

[copilot] – URL Shortener (Offline) Project#7

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-5
Draft

[copilot] – URL Shortener (Offline) Project#7
Copilot wants to merge 4 commits intomainfrom
copilot/fix-5

Conversation

Copy link
Contributor

Copilot AI commented Aug 20, 2025

This PR implements a complete Offline URL Shortener project as requested in the beginner-friendly contribution issue. The project provides a simple command-line tool that converts long URLs into short codes and stores them locally without requiring an internet connection.

🔗 Features Implemented

  • URL Shortening: Generates 6-character alphanumeric short codes (e.g., abc123) for long URLs
  • URL Expansion: Retrieves original URLs using short codes
  • Local Storage: Persists data in JSON format (url_mappings.json) for offline operation
  • Interactive CLI: Menu-driven interface with 5 options (shorten, expand, list, stats, exit)
  • Input Validation: Handles invalid URLs and missing short codes gracefully
  • Duplicate Detection: Returns existing short code for previously shortened URLs
  • Usage Analytics: Tracks creation timestamps and access counts for each URL
  • Error Handling: Comprehensive validation and user-friendly error messages

📁 Project Structure

week1_projects/copilot/URL_Shortener/
├── URL_Shortener.py    # Main application with URLShortener class
├── README.md           # Comprehensive documentation with examples
└── url_mappings.json   # Auto-generated data storage (created on first use)

🎯 Example Usage

Shortening a URL:

Input: https://github.com/NeuroByte-Society/weekend_projects
Output: Short code generated → K7m2Np

Expanding a code:

Input: K7m2Np  
Output: https://github.com/NeuroByte-Society/weekend_projects

🛠️ Technical Details

  • Language: Python 3.6+ with only built-in modules
  • Storage: JSON file for persistent data
  • Architecture: Object-oriented design with URLShortener class
  • Dependencies: No external packages required (json, random, string, os, datetime)

The implementation follows the repository's guidelines with proper folder structure, comprehensive README documentation, and beginner-friendly code with clear comments and error handling.

Also includes a .gitignore file to prevent Python cache files from being committed to the repository.

Fixes #5.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@ghostdeveloper404 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI and others added 3 commits August 20, 2025 17:31
Co-authored-by: ghostdeveloper404 <190269224+ghostdeveloper404@users.noreply.github.com>
…storage

Co-authored-by: ghostdeveloper404 <190269224+ghostdeveloper404@users.noreply.github.com>
Co-authored-by: ghostdeveloper404 <190269224+ghostdeveloper404@users.noreply.github.com>
Copilot AI changed the title [WIP] URL Shortener (Offline) [copilot] – URL Shortener (Offline) Project Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URL Shortener (Offline)

2 participants