|
@ -3,18 +3,6 @@ import re, os, json, sys |
|
|
from math import ceil, floor |
|
|
from math import ceil, floor |
|
|
from time import sleep |
|
|
from time import sleep |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
# python2 |
|
|
|
|
|
from urllib.parse import urlparse, urlunparse |
|
|
|
|
|
from urllib.request import urlopen |
|
|
|
|
|
from urllib.error import URLError, HTTPError |
|
|
|
|
|
from urllib.parse import urlencode |
|
|
|
|
|
from urllib.parse import quote_plus, unquote_plus |
|
|
|
|
|
from html.entities import name2codepoint |
|
|
|
|
|
|
|
|
|
|
|
input = raw_input |
|
|
|
|
|
except ImportError: |
|
|
|
|
|
# python3 |
|
|
|
|
|
from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus |
|
|
from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus |
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
from html.entities import name2codepoint |
|
|
from html.entities import name2codepoint |
|
@ -32,10 +20,6 @@ def padurl (padid, ): |
|
|
|
|
|
|
|
|
def padpath (padid, pub_path="", group_path="", normalize=False): |
|
|
def padpath (padid, pub_path="", group_path="", normalize=False): |
|
|
g, p = splitpadname(padid) |
|
|
g, p = splitpadname(padid) |
|
|
# if type(g) == unicode: |
|
|
|
|
|
# g = g.encode("utf-8") |
|
|
|
|
|
# if type(p) == unicode: |
|
|
|
|
|
# p = p.encode("utf-8") |
|
|
|
|
|
p = quote_plus(p) |
|
|
p = quote_plus(p) |
|
|
if normalize: |
|
|
if normalize: |
|
|
p = p.replace(" ", "_") |
|
|
p = p.replace(" ", "_") |
|
@ -128,4 +112,3 @@ def unescape(text): |
|
|
pass |
|
|
pass |
|
|
return text # leave as is |
|
|
return text # leave as is |
|
|
return re.sub("&#?\w+;", fixup, text) |
|
|
return re.sub("&#?\w+;", fixup, text) |
|
|
|
|
|
|
|
|