Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tessus/yourls-json-response
Add .json (or a custom string/character) to the short URL to get info about it as a JSON response.
https://github.com/tessus/yourls-json-response
yourls-extension
Last synced: 3 months ago
JSON representation
Add .json (or a custom string/character) to the short URL to get info about it as a JSON response.
- Host: GitHub
- URL: https://github.com/tessus/yourls-json-response
- Owner: tessus
- License: gpl-3.0
- Created: 2018-04-25T02:32:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-22T16:47:55.000Z (over 2 years ago)
- Last Synced: 2024-08-02T06:16:00.062Z (5 months ago)
- Topics: yourls-extension
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - JSON Response - Add `.json` (or a custom string/character) to the short URL to get info about it as a JSON response. (Plugins / J)
README
# JSON Response [![Listed in Awesome YOURLS!](https://img.shields.io/badge/Awesome-YOURLS-C5A3BE)](https://github.com/YOURLS/awesome-yourls/)
Plugin for [YOURLS](http://yourls.org/).
Add .json (or a custom string/character) to the short URL to get info about it as a JSON response.
## Installation
1. Change to the `user/plugins` directory
- `git clone https://github.com/tessus/yourls-json-response.git json-response`
or
- create a directory `json-response` and copy the [files of this repository](https://github.com/tessus/yourls-json-response/archive/master.zip) to it
2. Activate the plugin (in your YOURLS admin page)## Configuration
By default the suffix `.json` is used. However, it is possible to use a different string or character.
In `config.php` add the following (to change the suffix to `.j`):
```php
define('TESSUS_JSON_TRIGGER', '\.j');
```Please note that certain characters have to be escaped. The plugin uses a regex to search for the suffix. Therefore all characters that have a special meaning in the regex world will have to be escaped accordingly.
## Usage
Just add the JSON suffix to the short URL.
The JSON response consists of 4 keys: `url`, `title`, `keyword`, and `shorturl`.
### Example
```bash
$ curl -s http://g0to.ca/cu2t8.json |jq
{
"url": "https://www.amazon.ca/hz/wishlist/ls/109NPR6TPF108?&sort=default",
"title": "Helmut K. C. Tessarek's Wish List",
"keyword": "cu2t8",
"shorturl": "http://g0to.ca/cu2t8"
}
```## License
This plugin is licensed under the terms of the GNU General Public License, version 3 (GPLv3).
License conditions are included in [LICENSE](LICENSE) or can be found at the [GNU website](https://www.gnu.org/licenses/gpl.html).