233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
#-----------------
# Convert row["img"] or row["homepage"] into local favicon cache filename
# Use just domain for homepages, but most of the url for banner/logo imgs.
rx_strip_proto = re.compile("^\w+://|/$")
rx_just_domain = re.compile("^\w+://|[/#?].*$")
rx_non_wordchr = re.compile("[^\w._-]")
def row_to_fn(row):
url = row.get("img")
if url:
url = rx_strip_proto.sub("", url) # strip proto:// and trailing /
else:
|
|
|
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
#-----------------
# Convert row["img"] or row["homepage"] into local favicon cache filename
# Use just domain for homepages, but most of the url for banner/logo imgs.
rx_strip_proto = re.compile("^\w+://|/$|\.(png|gif|ico|jpe?g)$")
rx_just_domain = re.compile("^\w+://|[/#?].*$")
rx_non_wordchr = re.compile("[^\w._-]")
def row_to_fn(row):
url = row.get("img")
if url:
url = rx_strip_proto.sub("", url) # strip proto:// and trailing /
else:
|