but3k4 / youtube-views

Tool to increase YouTube views
BSD 3-Clause "New" or "Revised" License
86 stars 49 forks source link

YouTube Live Video: UnboundLocalError: local variable 'sleep_time' referenced before assignment #4

Closed shelomito12 closed 4 years ago

shelomito12 commented 4 years ago

Does it work for live videos?

Running the following command: python3 bot.py --visits 5 --url https://www.youtube.com/watch?v=_4dfderXXx --verbose

I'm getting the following error: video status: playing video duration time: 2:14:21:34 Traceback (most recent call last): File "bot.py", line 105, in <module> sys.exit(_main()) File "bot.py", line 99, in _main bot.run() File "bot.py", line 87, in run print('stopping video in %s seconds' % sleep_time) UnboundLocalError: local variable 'sleep_time' referenced before assignment

Seems to be complaining about the following section from the script: if video_duration: print('video duration time:', video_duration) seconds = utils.to_seconds(duration=video_duration.split(':')) if seconds: sleep_time = randrange(seconds) if self.opts.verbose: print('video duration time in seconds:', seconds) print('stopping video in %s seconds' % sleep_time) time.sleep(sleep_time) youtube.disconnect() count += 1

Any ideas?

but3k4 commented 4 years ago

Usually it happens when the video is not showing the duration time. I submitted a fix to avoid this kind of issue. Please, update your repository.