]> git.nbdom.net Git - nb.git/commitdiff
/opt/nb/lib/postgres/mime.sql
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 1 Nov 2019 15:36:16 +0000 (15:36 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 1 Nov 2019 15:36:16 +0000 (15:36 +0000)
lib/postgres/mime.sql

index 0892914a5606bade140859e0b3b17f1a744067fd..f5f0571640b2dfa1f65f15e446874014863ffdd7 100644 (file)
@@ -707,15 +707,8 @@ SELECT '>developer.mozilla.org' as log;
 DELETE FROM tmp_mime;
 COPY tmp_mime FROM PROGRAM 'true && curl -s \
 https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types \
-| tr -d "\n" \
-| sed "s/\\\n/\\n/g" \
-| sed -E "s,^(.*?)<table[^>]+>(.*?)</table>(.*?)$,\2," \
-| sed "s/<.tr>/\n/g" \
-| grep "<td" \
-| sed "s,<td>,\t,g" \
-| sed -E -e "s/ *<br[^>]*> */,/g" -e "s/,[^\t]+//" -e "s, *<[^>]+> *,,g" -e "s/^[\t ]*//" -e "s/([^\t]+)\t([^\t]+)$/\2\t\1/" \
-| perl -pe "0 and /^([^\t]+,[^\t]+)/ and @_=split(qq|,|,\$_) and s/^[^\t]+/join(qq|,|,sort {length(\$b)<=>length(\$a)} @_)/e" \
-| sed -e "s/^\.//" \
+| xmllint --html --xpath "/html/body//table[@class=\"standard-table\"]" - 2>/dev/null |html2csv - \
+| tail -n+2 | \
 ' WITH (format 'text', NULL '');
 INSERT INTO mime SELECT * FROM tmp_mime ON CONFLICT DO NOTHING;