Beispiel #1
0
def get_urls(post):
  candidates = get_url_candidates(post)
  urls = set()
  for u in candidates:
    if 'facebook' not in u:
      if is_short_url(u):
        u = unshorten_url(u)
      urls.add(prepare_url(u))
  return list(urls)
Beispiel #2
0
def parse_url(url):
  """
  unshorten and/or normalize url.
  """
  if is_short_url(url):
    long_url = unshorten_url(url)
    if long_url:
      return prepare_url(long_url)
    else:
      return url
  else:
    return prepare_url(url)