Merge remote-tracking branch 'dstftw/generic-webpage-unescape'
[youtube-dl] / youtube_dl / utils.py
index f60141bd1beaf6b2431fa1856dad053a9319833c..3574fc615c6eb54228c9b07c47ff0499b72333b7 100644 (file)
@@ -763,6 +763,10 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):
 
 def unified_strdate(date_str):
     """Return a string with the date in the format YYYYMMDD"""
+
+    if date_str is None:
+        return None
+
     upload_date = None
     #Replace commas
     date_str = date_str.replace(',', ' ')
@@ -1289,3 +1293,12 @@ if sys.version_info < (3, 0) and sys.platform == 'win32':
         return getpass.getpass(prompt, *args, **kwargs)
 else:
     compat_getpass = getpass.getpass
+
+
+US_RATINGS = {
+    'G': 0,
+    'PG': 10,
+    'PG-13': 13,
+    'R': 16,
+    'NC': 18,
+}