summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-04-21 13:45:27 +0200
committerPhilipp Hagemeister <[email protected]>2014-04-21 13:46:41 +0200
commit28746fbd59bb18f77eeaab49e0e284b8f31d7325 (patch)
treed8e75b6b3d918ca55c19a828e45aa62654da971d /youtube_dl/utils.py
parent0321213c1197b784aed884b10d5d63c2b396805c (diff)
downloadyoutube-dl-28746fbd59bb18f77eeaab49e0e284b8f31d7325.tar.gz
youtube-dl-28746fbd59bb18f77eeaab49e0e284b8f31d7325.zip
[bilibili] Add preliminary support (#2174)
The URL http://www.bilibili.tv/video/av636603/index_2.html does not work yet.
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index d4df78071..9190a8fb8 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1245,7 +1245,10 @@ class HEADRequest(compat_urllib_request.Request):
return "HEAD"
-def int_or_none(v, scale=1, default=None):
+def int_or_none(v, scale=1, default=None, get_attr=None):
+ if get_attr:
+ if v is not None:
+ v = getattr(v, get_attr, None)
return default if v is None else (int(v) // scale)