implement fallbacks and defaults in _search_regex
[youtube-dl] / youtube_dl / utils.py
index 616948e1080d18352189a48c4967644f4e761b20..3a8dcf4d3cb7e04c5cbf3a77f7e7fd7031218ff5 100644 (file)
@@ -150,6 +150,13 @@ try:
 except NameError:
     compat_chr = chr
 
+def compat_ord(c):
+    if type(c) is int: return c
+    else: return ord(c)
+
+# This is not clearly defined otherwise
+compiled_regex_type = type(re.compile(''))
+
 std_headers = {
     'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0',
     'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',