/Unalix-web

A simple web application (and also a Web API) written in Python.

Primary LanguagePythonGNU Lesser General Public License v3.0LGPL-3.0

This is a simple web application (and also a Web API) written in Python. It uses this library to allow users to remove tracking fields from URLs and unshort shortened URLs.

Installation

Note: You will need at least Python 3.6 and a Unix-like operating system.

Install all required dependences:

apt-get --assume-yes install \
    'python3' 'python3-pip' 'python3-setuptools' 'python3-wheel' 'git'

Create a separate user:

adduser --shell '/bin/bash' \
    --disabled-login \
    'unalix'

sudo -i --user='unalix'

Clone this repo:

git clone --ipv4 \
    --single-branch \
    --no-tags \
    --depth '1' \
    'https://github.com/AmanoTeam/Unalix-web'

Install all required libraries:

python3 -m pip install --force-reinstall \
    --disable-pip-version-check \
    --no-warn-script-location \
    --user \
    --upgrade \
    'setuptools' 'wheel' 'testresources' 'virtualenv' 'pip'

python3 -m virtualenv --download \
    --no-periodic-update \
    "${HOME}/Unalix-web/venv"

source "${HOME}/Unalix-web/venv/bin/activate"

pip install --force-reinstall \
    --disable-pip-version-check \
    --no-warn-script-location \
    --upgrade \
    'django' 'gunicorn' 'git+https://github.com/AmanoTeam/Unalix'

Start the webserver

cd "${HOME}/Unalix-web"

"${PWD}/venv/bin/gunicorn" \
    --workers '1' \
    --bind '127.0.0.1:35678' \
    'unalixweb.wsgi:application'

Now you have an instance running at http://127.0.0.1:35678/.

API usage

Removing tracking fields:

url='https://deezer.com/track/891177062?utm_source=deezer'

curl --url 'http://127.0.0.1:35678/' \
    --get \
    --data-urlencode "url=${url}" \
    --data-urlencode 'output=json' \
    --data-urlencode 'method=clear'

Unshortening a shortened URL:

url='https://bitly.is/Pricing-Pop-Up'

curl --url 'http://127.0.0.1:35678/' \
    --get \
    --data-urlencode "url=${url}" \
    --data-urlencode 'output=json' \
    --data-urlencode 'method=unshort'

Output from both examples:

{"new_url": "https://deezer.com/track/891177062"}
{"new_url": "https://bitly.com/pages/pricing"}

Note: You can replace http://127.0.0.1:35678/ with the address of any public instance.

Public instances

Don't want to run Unalix locally? Take a look at these public instances:

Third party software

Unalix-web includes some third party software. See them below: