Merge branch 'master' into patch-2
Browse files- pytube/query.py +3 -9
pytube/query.py
CHANGED
@@ -181,7 +181,6 @@ class StreamQuery:
|
|
181 |
has_attribute = [
|
182 |
s for s in self.fmt_streams if getattr(s, attribute_name) is not None
|
183 |
]
|
184 |
-
|
185 |
# Check that the attributes have string values.
|
186 |
if has_attribute and isinstance(getattr(has_attribute[0], attribute_name), str):
|
187 |
# Try to return a StreamQuery sorted by the integer representations
|
@@ -257,10 +256,7 @@ class StreamQuery:
|
|
257 |
|
258 |
"""
|
259 |
return (
|
260 |
-
self.filter(progressive=True, subtype="mp4")
|
261 |
-
.order_by("resolution")
|
262 |
-
.desc()
|
263 |
-
.last()
|
264 |
)
|
265 |
|
266 |
def get_highest_resolution(self) -> Optional[Stream]:
|
@@ -272,7 +268,7 @@ class StreamQuery:
|
|
272 |
not found.
|
273 |
|
274 |
"""
|
275 |
-
return self.filter(progressive=True).order_by("resolution").
|
276 |
|
277 |
def get_audio_only(self, subtype: str = "mp4") -> Optional[Stream]:
|
278 |
"""Get highest bitrate audio stream for given codec (defaults to mp4)
|
@@ -285,9 +281,7 @@ class StreamQuery:
|
|
285 |
not found.
|
286 |
|
287 |
"""
|
288 |
-
return (
|
289 |
-
self.filter(only_audio=True, subtype=subtype).order_by("abr").asc().last()
|
290 |
-
)
|
291 |
|
292 |
def first(self) -> Optional[Stream]:
|
293 |
"""Get the first :class:`Stream <Stream>` in the results.
|
|
|
181 |
has_attribute = [
|
182 |
s for s in self.fmt_streams if getattr(s, attribute_name) is not None
|
183 |
]
|
|
|
184 |
# Check that the attributes have string values.
|
185 |
if has_attribute and isinstance(getattr(has_attribute[0], attribute_name), str):
|
186 |
# Try to return a StreamQuery sorted by the integer representations
|
|
|
256 |
|
257 |
"""
|
258 |
return (
|
259 |
+
self.filter(progressive=True, subtype="mp4").order_by("resolution").first()
|
|
|
|
|
|
|
260 |
)
|
261 |
|
262 |
def get_highest_resolution(self) -> Optional[Stream]:
|
|
|
268 |
not found.
|
269 |
|
270 |
"""
|
271 |
+
return self.filter(progressive=True).order_by("resolution").last()
|
272 |
|
273 |
def get_audio_only(self, subtype: str = "mp4") -> Optional[Stream]:
|
274 |
"""Get highest bitrate audio stream for given codec (defaults to mp4)
|
|
|
281 |
not found.
|
282 |
|
283 |
"""
|
284 |
+
return self.filter(only_audio=True, subtype=subtype).order_by("abr").last()
|
|
|
|
|
285 |
|
286 |
def first(self) -> Optional[Stream]:
|
287 |
"""Get the first :class:`Stream <Stream>` in the results.
|