コード例 #1
0
ファイル: url_parse.py プロジェクト: zanachka/minet
def extract_standard_addendum(cli_args, url):
    inferred_redirection = infer_redirection(url)

    return [
        normalize_url(url,
                      strip_protocol=cli_args.strip_protocol,
                      strip_trailing_slash=True),
        inferred_redirection if inferred_redirection != url else '',
        get_domain_name(url),
        get_hostname(url),
        get_normalized_hostname(url), 'yes' if is_shortened_url(url) else ''
    ]
コード例 #2
0
    def url_key(item):
        url = item[1][url_pos].strip()

        if not url:
            return

        if only_shortened and not is_shortened_url(url):
            return

        # Url templating
        if cli_args.url_template:
            return cli_args.url_template.format(value=url)

        return url
コード例 #3
0
ファイル: is_shortened_test.py プロジェクト: paubre/ural
 def test_basics(self):
     for url, result in TESTS:
         assert is_shortened_url(url) == result