mirror of
https://github.com/ihabunek/twitch-dl
synced 2024-08-30 18:32:25 +00:00
da60560b63
* allow resuming * retry downloads * add timeouts
12 lines
359 B
Python
12 lines
359 B
Python
import re
|
|
import unicodedata
|
|
|
|
|
|
def slugify(value):
|
|
re_pattern = re.compile(r'[^\w\s-]', flags=re.U)
|
|
re_spaces = re.compile(r'[-\s]+', flags=re.U)
|
|
value = str(value)
|
|
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
|
|
value = re_pattern.sub('', value).strip().lower()
|
|
return re_spaces.sub('-', value)
|