Sid Shardanand
commited on
fixing type casting bug and reinforcing _ naming convention (#1390)
Browse files- pytube/streams.py +9 -9
pytube/streams.py
CHANGED
@@ -65,13 +65,13 @@ class Stream:
|
|
65 |
self._filesize: Optional[int] = int(stream.get('contentLength', 0))
|
66 |
|
67 |
# filesize in kilobytes
|
68 |
-
self._filesize_kb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 * 1000) / 1000)
|
69 |
|
70 |
# filesize in megabytes
|
71 |
-
self._filesize_mb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 / 1024 * 1000) / 1000)
|
72 |
|
73 |
# filesize in gigabytes(fingers crossed we don't need terabytes going forward though)
|
74 |
-
self._filesize_gb: Optional[float] = float(ceil(stream.get('contentLength', 0) / 1024 / 1024 / 1024 * 1000) / 1000)
|
75 |
|
76 |
# Additional information about the stream format, such as resolution,
|
77 |
# frame rate, and whether the stream is live (HLS) or 3D.
|
@@ -162,8 +162,8 @@ class Stream:
|
|
162 |
return self._filesize
|
163 |
|
164 |
@property
|
165 |
-
def
|
166 |
-
"""File size of the media stream in
|
167 |
|
168 |
:rtype: float
|
169 |
:returns:
|
@@ -179,8 +179,8 @@ class Stream:
|
|
179 |
return self._filesize_kb
|
180 |
|
181 |
@property
|
182 |
-
def
|
183 |
-
"""File size of the media stream in
|
184 |
|
185 |
:rtype: float
|
186 |
:returns:
|
@@ -196,8 +196,8 @@ class Stream:
|
|
196 |
return self._filesize_mb
|
197 |
|
198 |
@property
|
199 |
-
def
|
200 |
-
"""File size of the media stream in
|
201 |
|
202 |
:rtype: float
|
203 |
:returns:
|
|
|
65 |
self._filesize: Optional[int] = int(stream.get('contentLength', 0))
|
66 |
|
67 |
# filesize in kilobytes
|
68 |
+
self._filesize_kb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 * 1000) / 1000)
|
69 |
|
70 |
# filesize in megabytes
|
71 |
+
self._filesize_mb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 / 1024 * 1000) / 1000)
|
72 |
|
73 |
# filesize in gigabytes(fingers crossed we don't need terabytes going forward though)
|
74 |
+
self._filesize_gb: Optional[float] = float(ceil(float(stream.get('contentLength', 0)) / 1024 / 1024 / 1024 * 1000) / 1000)
|
75 |
|
76 |
# Additional information about the stream format, such as resolution,
|
77 |
# frame rate, and whether the stream is live (HLS) or 3D.
|
|
|
162 |
return self._filesize
|
163 |
|
164 |
@property
|
165 |
+
def filesize_kb(self) -> float:
|
166 |
+
"""File size of the media stream in kilobytes.
|
167 |
|
168 |
:rtype: float
|
169 |
:returns:
|
|
|
179 |
return self._filesize_kb
|
180 |
|
181 |
@property
|
182 |
+
def filesize_mb(self) -> float:
|
183 |
+
"""File size of the media stream in megabytes.
|
184 |
|
185 |
:rtype: float
|
186 |
:returns:
|
|
|
196 |
return self._filesize_mb
|
197 |
|
198 |
@property
|
199 |
+
def filesize_gb(self) -> float:
|
200 |
+
"""File size of the media stream in gigabytes.
|
201 |
|
202 |
:rtype: float
|
203 |
:returns:
|