Tools for parsing, extracting, reconciling, and unshortening urls
Project description
A newslynx-opinionated collection of utilities for dealing with urls.
Install
pip install newslynx-url
Test
requires nose
nosetests
Usage
This module contains various methods that are used throughout newslnyx-core. but the main functions are unshorten_url, is_article_url, and prepare_url:
from newslynx_url import (
unshorten_url, is_article_url, prepare_url
)
print unshorten_url('bit.ly/1j3SrUC')
# http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism/
print is_article_url(
'http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism'
)
# True
print is_article_url(
'http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism',
pattern = r'.*towcenter\.org/blog/.*'
)
# True
import re
pattern = re.compile(r'.*towcenter\.org/blog/.*')
print is_article_url(
'http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism',
pattern = pattern
)
# True
print prepare_url(
'http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism/?q=lfjad&f=lkfdjsal'
)
# http://towcenter.org/blog/tow-fellows-brian-abelson-and-michael-keller-to-study-the-impact-of-journalism
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
newslynx-url-0.1.0.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for newslynx-url-0.1.0.macosx-10.9-intel.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10882293c4cc71b218605df61eb58113fb6a7b97a60c1dc8eacb8e5d7f459ccc |
|
MD5 | ed2cff1b8d2b5b0a4a532b37b9e65e7b |
|
BLAKE2b-256 | 7bc8f6685a419260d27d94de5801e85f24e8c1b84046c1f740544969d3715d4a |