Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brunoooost/url2ndef
The url2ndef repository converts URLs into NDEF (NFC Data Exchange Format) for NFC tags.
https://github.com/brunoooost/url2ndef
ndef nfc python-3 python-package url2ndef
Last synced: 27 days ago
JSON representation
The url2ndef repository converts URLs into NDEF (NFC Data Exchange Format) for NFC tags.
- Host: GitHub
- URL: https://github.com/brunoooost/url2ndef
- Owner: brunoooost
- Created: 2024-12-03T11:17:30.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-03T16:39:00.000Z (30 days ago)
- Last Synced: 2024-12-03T17:45:18.317Z (30 days ago)
- Topics: ndef, nfc, python-3, python-package, url2ndef
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **url2ndef**
This script takes a URL, detects its protocol, and converts the URL into a properly formatted NFC NDEF (NFC Data Exchange Format) message. Itβs perfect for **NFC applications** where a URL needs to be encoded onto a tag. The script processes the URL, identifies the protocol, calculates the URL length, converts it into hexadecimal format, and generates the corresponding NFC NDEF message.
---
## π **Features**
- **π Protocol Detection**: Automatically detects common URL protocols like `http://`, `https://`, `tel:`, and `mailto:`.
- **π» Hexadecimal Conversion**: Converts the URL (excluding the protocol) into a hex representation.
- **π‘ NFC NDEF Structure**: Generates an NFC-compatible NDEF message that includes the protocol identifier, URL length, and hex-encoded URL.
- **π¨βπ» User-friendly**: Simply input a URL, and the script will return the corresponding NFC NDEF message.---
## βοΈ **How It Works**
1. **π§ Protocol Identification**:
- The script checks the URLβs protocol (e.g., `https://`, `http://`, etc.).
- Each protocol gets a specific identifier (e.g., `02` for `https://`).2. **π’ URL Processing**:
- After the protocol is identified, the script calculates the length of the remaining URL (without the protocol).
- The rest of the URL is converted into a **hexadecimal** format, which is NFC-compatible.3. **π Generate NFC NDEF Message**:
- The script assembles the data into an **NFC NDEF message** with:
- **Protocol identifier**
- **Length of the URL (excluding the protocol)**
- **Hexadecimal representation of the URL content**---
## π‘ **Example**
### π₯ **Input**
When prompted, paste a URL:
```bash
Paste the URL link: https://www.example.com
```### π€ **Output**
The script will output the corresponding **NFC NDEF message**:
```
D1 01 1A 55 02 68 74 74 70 73 3A 2F 2F 77 77 77 2E 65 78 61 6D 70 6C 65 2E 63 6F 6D
```---
## π οΈ **How to Use**
### Step 1: Clone or Download the Script
Clone or download the script to your local machine to get started.
### Step 2: Run the Script
Run the Python script in a **Python 3.x** environment.
### Step 3: Input a URL
When prompted, **paste a URL**, and the script will process it and output the NFC NDEF message.
Example:
```bash
Paste the URL link: https://www.example.com
```The script will then generate and display the NFC NDEF message.
---
## π **Requirements**
- **Python 3.x**: Make sure you have Python 3.x installed on your system.
- No additional libraries are neededβjust Python itself.---