FIX: resolve_redirections.lua: Normalize YouTube input URL
commitcf39991cbf1840bcd9796065b00088d61d6d7e2a
authorToni Gundogdu <legatvs@gmail.com>
Mon, 7 Oct 2013 13:14:58 +0000 (7 16:14 +0300)
committerToni Gundogdu <legatvs@gmail.com>
Mon, 7 Oct 2013 18:51:34 +0000 (7 21:51 +0300)
tree76dc7e932152a51dfd0f4083e053208188fb5bb5
parent4e5bef34316090a41e83b6f2ee7c94b2f3cafa72
FIX: resolve_redirections.lua: Normalize YouTube input URL

libquvi will always attempt to resolve URL redirections.  This means
that quvi_media_new (for example) will always resolve first and only
then pass the input URL to the media scripts to determine the support

Problem:
  - g00gle now redirects the embedded media URLs to the API pages

  - This causes libquvi to return the "no support" because the
    destination URL looks nothing like a typical media page URL

Solution:
  - "normalize" (quvi/youtube) the input URL before we try to resolve
    URL redirections

  - "normalize" will convert the embedded media URLs to media page URLs,
    which can then be passed to libquvi/libcurl for URL resolving

Notes:
  - quvi_supports function skips resolving altogether unless online
    check is forced

  - This is the reason "normalize" must still be called in "ident"
    function of the media script, even if this script does so

Signed-off-by: Toni Gundogdu <legatvs@gmail.com>
share/util/resolve_redirections.lua