jonathanagustin commited on
Commit
3263472
1 Parent(s): a1b8cee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -31,8 +31,11 @@ import innertube
31
  import numpy as np
32
  from PIL import Image
33
  from ultralytics import YOLO
 
 
34
  from pytube import YouTube
35
 
 
36
  logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
37
 
38
 
@@ -102,7 +105,9 @@ class SearchService:
102
  """
103
  try:
104
  yt = YouTube(youtube_url)
105
- if yt.is_live:
 
 
106
  streaming_data = yt.player_response.get('streamingData', {})
107
  hls_manifest_url = streaming_data.get('hlsManifestUrl')
108
  if hls_manifest_url:
 
31
  import numpy as np
32
  from PIL import Image
33
  from ultralytics import YOLO
34
+
35
+ # Import pytube
36
  from pytube import YouTube
37
 
38
+ # Set up logging
39
  logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
40
 
41
 
 
105
  """
106
  try:
107
  yt = YouTube(youtube_url)
108
+ # Check if the video is a live stream
109
+ is_live = yt.player_response.get('videoDetails', {}).get('isLiveContent', False)
110
+ if is_live:
111
  streaming_data = yt.player_response.get('streamingData', {})
112
  hls_manifest_url = streaming_data.get('hlsManifestUrl')
113
  if hls_manifest_url: