hbmartin commited on
Commit
d2eed62
·
1 Parent(s): dc3bd9b

reformatting

Browse files
Files changed (2) hide show
  1. pytube/itags.py +28 -2
  2. tests/contrib/test_playlist.py +8 -2
pytube/itags.py CHANGED
@@ -98,9 +98,32 @@ _3D = [82, 83, 84, 85, 100, 101, 102]
98
  LIVE = [91, 92, 93, 94, 95, 96, 132, 151]
99
  DASH_MP4_VIDEO = [133, 134, 135, 136, 137, 138, 160, 212, 264, 266, 298, 299]
100
  DASH_MP4_AUDIO = [139, 140, 141, 256, 258, 325, 328]
101
- DASH_WEBM_VIDEO = [167, 168, 169, 170, 218, 219, 278, 242, 243, 244, 245, 246, 247, 248, 271, 272, 302, 303, 308, 313, 315]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  DASH_WEBM_AUDIO = [171, 172, 249, 250, 251]
103
 
 
104
  def get_format_profile(itag: int) -> Dict:
105
  """Get additional format information for a given itag.
106
 
@@ -119,5 +142,8 @@ def get_format_profile(itag: int) -> Dict:
119
  "is_3d": itag in _3D,
120
  "is_hdr": itag in HDR,
121
  "fps": 60 if itag in _60FPS else 30,
122
- "is_dash": itag in DASH_MP4_VIDEO or itag in DASH_MP4_AUDIO or itag in DASH_WEBM_VIDEO or itag in DASH_WEBM_AUDIO,
 
 
 
123
  }
 
98
  LIVE = [91, 92, 93, 94, 95, 96, 132, 151]
99
  DASH_MP4_VIDEO = [133, 134, 135, 136, 137, 138, 160, 212, 264, 266, 298, 299]
100
  DASH_MP4_AUDIO = [139, 140, 141, 256, 258, 325, 328]
101
+ DASH_WEBM_VIDEO = [
102
+ 167,
103
+ 168,
104
+ 169,
105
+ 170,
106
+ 218,
107
+ 219,
108
+ 278,
109
+ 242,
110
+ 243,
111
+ 244,
112
+ 245,
113
+ 246,
114
+ 247,
115
+ 248,
116
+ 271,
117
+ 272,
118
+ 302,
119
+ 303,
120
+ 308,
121
+ 313,
122
+ 315,
123
+ ]
124
  DASH_WEBM_AUDIO = [171, 172, 249, 250, 251]
125
 
126
+
127
  def get_format_profile(itag: int) -> Dict:
128
  """Get additional format information for a given itag.
129
 
 
142
  "is_3d": itag in _3D,
143
  "is_hdr": itag in HDR,
144
  "fps": 60 if itag in _60FPS else 30,
145
+ "is_dash": itag in DASH_MP4_VIDEO
146
+ or itag in DASH_MP4_AUDIO
147
+ or itag in DASH_WEBM_VIDEO
148
+ or itag in DASH_WEBM_AUDIO,
149
  }
tests/contrib/test_playlist.py CHANGED
@@ -23,6 +23,12 @@ def test_init_with_playlist_url():
23
 
24
 
25
  def test_init_with_watch_url():
26
- url = "https://www.youtube.com/watch?v=1KeYzjILqDo&list=PLynhp4cZEpTbRs_PYISQ8v_uwO0_mDg_X&index=2&t=661s"
 
 
 
27
  playlist = Playlist(url)
28
- assert playlist.playlist_url == "https://www.youtube.com/playlist?list=PLynhp4cZEpTbRs_PYISQ8v_uwO0_mDg_X"
 
 
 
 
23
 
24
 
25
  def test_init_with_watch_url():
26
+ url = (
27
+ "https://www.youtube.com/watch?v=1KeYzjILqDo&"
28
+ "list=PLynhp4cZEpTbRs_PYISQ8v_uwO0_mDg_X&index=2&t=661s"
29
+ )
30
  playlist = Playlist(url)
31
+ assert (
32
+ playlist.playlist_url
33
+ == "https://www.youtube.com/playlist?list=PLynhp4cZEpTbRs_PYISQ8v_uwO0_mDg_X"
34
+ )