[NTG-context] Downloading long urls

Hans Hagen pragma at wxs.nl
Sun Jan 23 21:22:27 CET 2011

On 22-1-2011 1:20, Aditya Mahajan wrote:

> A simple algorithm with assume that everything following the dot is the
> extension, while that is certainly not the case here. We can definitely
> restrict the search of extension to the last 10 or so characters of the
> url, but there will be cases when such heuristics will fail.

it's not that complicated ... say that you patch this way:

function schemes.cleanname(specification)
     return (gsub(specification.original,"[^%a%d%.]+","-"))

local function fetch(specification)
     local original  = specification.original
     local scheme    = specification.scheme
     local cleanname = schemes.cleanname(specification)

that will be the current method. Now you can experiment with:

function resolvers.schemes.cleanname(specification)
     local name = specification.original
     local hash = 
     logs.simple("%s => %s",name,hash)
     return hash

Just see how that works out


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the ntg-context mailing list