forked from geekcomputers/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_youtube_view.py
More file actions
30 lines (26 loc) · 850 Bytes
/
get_youtube_view.py
File metadata and controls
30 lines (26 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""
Created on Thu Apr 27 16:28:36 2017
@author: barnabysandeford
"""
# Currently works for Safari, but just change to whichever
# browser you're using.
import time
#Changed the method of opening the browser.
#Selenium allows for the page to be refreshed.
from selenium import webdriver
#adding ability to change number of repeats
count = int(raw_input("Number of times to be repeated: "))
#Same as before
x = raw_input("Enter the URL (no https): ")
print( "Length of video:")
minutes = int(raw_input("Minutes "))
seconds = int(raw_input("Seconds "))
#Calculating the refreshrate from the user input
refreshrate = minutes * 60 + seconds
#Selecting Safari as the browser
driver = webdriver.Safari()
driver.get("http://"+x)
for i in range(count):
#Sets the page to refresh at the refreshrate.
time.sleep(refreshrate)
driver.refresh()