- You will need to install Python and Selenium
- Video for reference (PT-BR):
- Python: https://www.youtube.com/watch?v=FcfalMf9bRY
- Selenium: https://www.youtube.com/watch?v=Ot10qzrb13c (choose the version compatible with your browser)
- Remember to put Python on windows PATH (during installation)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import sys
if len(sys.argv) == 2:
movie = sys.argv[1]
else:
movie = ' '.join(sys.argv[1:])
# You can put the chromedriver wherever you want - you can download it from http://seleniumhq.github.io/selenium/docs/api/javascript/
PATH = r"C:\chromedriver.exe"
# You can select any browser available for Selenium
driver = webdriver.Chrome(PATH)
#Netflix login initial page
driver.get("https://www.netflix.com/br/login")
element = driver.find_element_by_name("userLoginId")
#Insert your email
element.send_keys("netflixacc@gmail.com")
time.sleep(0.2)
#Insert your password
element2 = driver.find_element_by_name("password")
element2.send_keys("netflixpassword")
time.sleep(0.3)
element2.send_keys(Keys.RETURN)
time.sleep(2)
#Insert your profile name as seen after you log in
profile = driver.find_element_by_link_text("netflixprofilename")
profile.click()
time.sleep(3)
search = driver.find_element_by_class_name("searchBox")
search.click()
time.sleep(1)
searchbox = driver.find_element_by_name("searchInput")
searchbox.send_keys(movie)
time.sleep(0.5)
searchbox.send_keys(Keys.RETURN)
time.sleep(2)
scene = driver.find_element_by_xpath("/html/body/div[1]/div/div/div[1]/div/div[2]/div/div/div/div[2]/div/div/div[1]/div/div/div/div/div/div[1]")
scene.click()
time.sleep(0.5)
submit = driver.find_element_by_xpath("//button[@class='color-primary hasLabel hasIcon ltr-1jnopvq']")
submit.click()
time.sleep(5)
move = driver.find_element_by_xpath("//button[@class='touchable PlayerControls--control-element nfp-button-control default-control-button button-nfplayerBack tooltip-button tooltip-button-pos-center tooltip-button-align-right']")
move.send_keys(Keys.TAB)
time.sleep(0.5)
fullscreen = driver.find_element_by_xpath("//button[@class='touchable PlayerControls--control-element nfp-button-control default-control-button button-nfplayerFullscreen']")
fullscreen.click()
On TRIGGERcmd:
Trigger: Search on Netflix
(EXAMPLE) Command: start C:\PycharmProjects\netflix\netflix.py
(You need to put your py file directory)
Ground: foreground
Voice: netflix
Allow parameters: true
Portuguese:
Activate Execute Comando skill on Alexa app
To Alexa: "Alexa, pergunte Execute Comando executar netflix com parâmetro the alienist"
English:
Activate TRIGGERcmd skill on Alexa app
To Alexa: "Alexa, ask TRIGGERcmd to run netflix on the alienist"
Any updates I will edit the post. There are things that I want to improve (like the sleep time)