]> git.phdru.name Git - dotfiles.git/blobdiff - bin/decode-URLs.py
Feat(recode-filenames-recursive): Allow to omit parameters
[dotfiles.git] / bin / decode-URLs.py
index 70400abb29df900a8c3adc3bbd8475340cf25493..ef04664342a87b7a5d5dc1c65045aa3399aee77d 100755 (executable)
@@ -1,12 +1,16 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
-import sys, urllib
+try:
+    from urllib.parse import unquote
+except ImportError:
+    from urllib import unquote
+import sys
 
 while True:
    url = sys.stdin.readline()
    if not url:
       break
-   unqoted = urllib.unquote(url.strip())
+   unqoted = unquote(url.strip())
    if unqoted.startswith('file://'):
        unqoted = unqoted[len('file://'):]
-   print unqoted
+   print(unqoted)