Live data from Hacker News

New tool from curl creator – trurl – for URL parsing and manipulation

daniel.haxx.se

1–10 of 40 posts

Re: New tool from curl creator – trurl – for URL parsing and manipulation

#6
https://github.com/curl/trurl

Apparently, it requires curl 7.81 to compile, but I'm on ubuntu 20 (7.6x) and wanted to do a quick try, so this patch makes it work (trivially) by removing the couple of new symbols depending on that newer version. Just a quick hack to compile.

   --- a/trurl.c
   +++ b/trurl.c
   @@ -362,11 +362,12 @@ static void get(struct option *op, CURLU *uh)
         case CURLUE_NO_PORT:
         case CURLUE_NO_QUERY:
         case CURLUE_NO_FRAGMENT:
   -            case CURLUE_NO_ZONEID:
   +            // would require 7.81
   +            // case CURLUE_NO_ZONEID:
           /\* silently ignore */
           break;
         default:
   -              fprintf(stderr, PROGNAME ": %s (%s)\n", curl_url_strerror(rc),
   +              fprintf(stderr, PROGNAME ": %s (%s)\n", rc,
            variables[i].name);
           break;
         }
   @@ -589,8 +590,8 @@ static void singleurl(struct option *o,
           CURLU_GUESS_SCHEME|CURLU_NON_SUPPORT_SCHEME);
          if(rc) {
     if(o->verify)
   -          errorf(ERROR_BADURL, "%s [%s]", curl_url_strerror(rc), url);
   -        warnf("%s [%s]", curl_url_strerror(rc), url);
   +          errorf(ERROR_BADURL, "%s [%s]", rc, url);
   +        warnf("%s [%s]", rc, url);
          }
          else {
     if(o->redirect)

Re: New tool from curl creator – trurl – for URL parsing and manipulation

#8
post #3

The readme should include a pronunciation guide for the name. tru-rul? tee-ru-rul?

Trurl is the name of a character in the science fiction short story collection "The Cyberiad" by Polish author Stanisław Lem. Trurl is a highly intelligent robot and inventor who, along with his friend Klapaucius, goes on various adventures throughout the universe. — via CGPT

Re: New tool from curl creator – trurl – for URL parsing and manipulation

#10
Pretty dang cool, but I might have missed a feature: can trurl do multiple manipulations on a single url, as opposed to a single manipulation on multiple urls (which the blog post says is supported)?

For example, you want to apply a sequence of predefined normalization steps, such as removing the user part, converting http to https, etc etc. You put these steps in a file and then invoke trurl with that file and pointed at your url or urls. Very much like what you would do in sed, say. Possible?

Post reply on HN