|
|
@ -3,21 +3,9 @@ import re, os, json, sys |
|
|
|
from math import ceil, floor |
|
|
|
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.request import urlopen, URLError, HTTPError |
|
|
|
from html.entities import name2codepoint |
|
|
|
from urllib.parse import urlparse, urlunparse, urlencode, quote_plus, unquote_plus |
|
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
|
from html.entities import name2codepoint |
|
|
|
|
|
|
|
groupnamepat = re.compile(r"^g\.(\w+)\$") |
|
|
|
def splitpadname (padid): |
|
|
@ -32,10 +20,6 @@ def padurl (padid, ): |
|
|
|
|
|
|
|
def padpath (padid, pub_path="", group_path="", normalize=False): |
|
|
|
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) |
|
|
|
if normalize: |
|
|
|
p = p.replace(" ", "_") |
|
|
@ -128,4 +112,3 @@ def unescape(text): |
|
|
|
pass |
|
|
|
return text # leave as is |
|
|
|
return re.sub("&#?\w+;", fixup, text) |
|
|
|
|
|
|
|