Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Unshortens adf.ly, sh.st, and any 301 redirected shortener urls

Project Description

Unshortens ad-based urls and 301 redirects. Supports adf.ly, lnx.lu, and sh.st.

  • Linkbucks.com and adfoc.us support temporarly removed.

Features

  • Supports unshortening the following ad-based shortners:
    • Adf.ly and related subdomains
    • Custom adf.ly domains by passing the type=’adfly’ parameter
    • Sh.st
  • Supports any 301 redirected urls
  • Python 2.7, 3.3, and 3.4 support

Usage

import unshortenit

# Unshorten known ad urls. # This call will not generate any HTTP requests unless the passed # URL is a known ad/shortening link, and the library knows how to # unshortedn said link. unshortened_uri, status = unshortenit.unshorten_only(‘http://ul.to’)

# Unwrap any HTTP 30x redirects (if present). This will always issue a HTTP # HEAD request, even if there is not a 30x redirect on the passed link # (you cannot tell if a redirect is present without making a request). unshortened_uri, status = unshortenit.unwrap_30x_only(‘http://ul.to’)

# Unshorten any ad content, and unwrap any HTTP 30x redirects (if present). # Internally, this basically calls unshorten_only(), and then unwrap_30x_only() # sequentially on the passed URL, returning early if the unshorten_only() # call returned an error. unshortened_uri, status = unshortenit.unshorten(‘http://ul.to’)

> All calls will return a tuple (unshortened_uri, status)

> unshortened_uri will contain the unshortened uri. If you pass in a non-shortener url it will return the original url. > status will contain the status code or any error messages

Installation

pip install unshortenit

History

0.1.0 (2013-10-08)

  • First release.

0.1.1 (2013-10-11)

  • Added support for custom adf.ly domains via the type=’adfly’ variable.

0.1.2 (2013-10-11)

  • Fixed bug with t.co not working.

0.1.3 (2013-10-11)

  • Added a timeout parameter

0.1.4 (2013-10-12)

  • Added support for p.ost.im.
  • Fixed blocking issue with direct links to file downloads

0.1.6 (2014-02-01)

  • Fixed adfoc.us issues resulting from changes to their site
  • Fixed linkbucks.com issues resulting from changes to their site

0.1.7 (2014-02-03)

  • Fixed linkbucks.com issues resulting from additional changes to their site

0.1.8 (2014-02-04)

  • Fixed linkbucks.com issues resulting from additional changes to their site

0.1.9 (2014-02-08)

  • Switched linkbucks.com to use selenium PhantomJS driver due to ongoing challenges with their site

0.2.0 (2014-02-25)

  • Removed PyV8 requirement for adf.ly
  • Added ay.gy domain for adf.ly regex
  • Added sh.st support

0.2.1 (2014-05-18)

  • Removed tests for linkbucks.com and adfoc.us. Support has been temporarly removed.
  • Merged Debian Python 3.2 fix by anaconda

0.2.2 (2014-07-28)

  • Removed lnx.lu as site is out of service

0.2.3 (2015-11-13)

  • Fixed sh.st support

0.3.0 (2016-05-20)

  • Split out unshortening and unwrapping 301 redirects into separate calls.
  • Added support for unwrapping google proxy links.
  • Some general cleanup in tests, updated some of the test links.
  • Handle anonymz.com links (provided by @guigarfr)
  • Handle href.li links (provided by @guigarfr)
  • Update user-agents (provided by @Dreysman)

0.3.1 (2017-11-26)

  • Fixed adf.ly decoding issues (provided by @marlowww)
Release History

Release History

This version
History Node

0.3.1

History Node

0.3.0

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.8

History Node

0.1.7

History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
unshortenit-0.3.1.tar.gz (9.1 kB) Copy SHA256 Checksum SHA256 Source Nov 26, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting