Jump to content

Disney Plus Show Request


aaron832
 Share

Recommended Posts

Hello everyone. 

Just wanted to share my Disney Plus automated script in the hopes that others might be able to make improvements to some of the brute force stuff I have done.

I use this script with google home to request "I want to watch X on Disney Plus."

Improvements:

* I would like to be able to choose a profile.

* Remove keyboard inputs for tabbing to select buttons / shows.

#include <IE.au3>
#include <Constants.au3>
#include <Misc.au3>
#include "commonfunc.au3"

_Singleton("start_playsearchdisney")

if Not ($CmdLine[0] >= 1) Then
   MsgBox(0, "Play Search Netflix", "No paramters... searching Moana")
   ;Exit 1
EndIf

$searchtext = "Moana"
if($CmdLine[0] >= 1) Then
   $searchtext = $CmdLine[1]
EndIf

CloseAll()
TurnOnTV()
SetAudioTV()

Local $oIE = _IECreate("disneyplus.com/search")
If @error Then Exit MsgBox(48, "", "_IECreate() Error", 3)
Sleep (5000) ;5 second sleep to make sure everything loads.

;Get the search box element
$oForm = _IEGetObjById($oIE, "search-input")
if @error Then
   MsgBox(0, "Play Search Disney Error", "Couldnt get search form.", 5)
   _IEQuit($oIE)
   Exit
EndIf
;Enter our search result into the field.
_IEFormElementSetValue($oForm, $searchtext)
;Submit
Send("{ENTER}")
;Brute force select the resulting show.  3 tabs required for IExplorer for some reason.
Sleep (2000)
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{ENTER}")

Sleep (4000)

Send("{TAB}") ;Skip to content
Sleep (500)
Send("{ENTER}") ;Skip to content enter
Send("{ENTER}") ;Play button

;Move the mouse out of the way.
MouseMove(500,500)

 

Also, including my netflix script in which I was able to avoid keyboard input for navigation.  Also a profile can be used.

#include <IE.au3>
#include <Constants.au3>
#include <Misc.au3>
#include "commonfunc.au3"

_Singleton("start_playsearchnetflix")

if Not ($CmdLine[0] >= 1) Then
   MsgBox(0, "Play Search Netflix", "Bad number of params: " & $CmdLine[0])
   Exit 1
EndIf

CloseAll()
TurnOnTV()
SetAudioTV()

Local $profileHash = "xxxxxxxxxxxxxx"
if ($CmdLine[0] >= 2) Then
   Switch $CmdLine[2]
   Case "User2"
      $profileHash = "xxxxxxxxxxxxx"
   Case "User3"
      $profileHash = "xxxxxxxxxxxxx"
   EndSwitch
EndIf

CloseAll()

MouseMove(0,0)
Local $oIE = _IECreate("www.netflix.com/SwitchProfile?tkn=" & $profileHash)
If @error Then Exit MsgBox(48, "", "_IECreate() Error", 3)
Sleep (2000)
Local $oApp = _IEGetObjById($oIE,"appMountPoint")
$oApp.childnodes.item(0).childnodes.item(0).childnodes.item(0).childnodes.item(0).childnodes.item(2).childnodes.item(0).childnodes.item(0).childnodes.item(0)

$tags = $oIE.document.GetElementsByTagName("button")
For $tag in $tags
    $class_value = $tag.className
    If $class_value = "searchTab" Then
        Local $oSearchBox = $tag
        ExitLoop
    EndIf
Next

if Not ($oSearchBox.className == "searchTab") Then
   MsgBox(0, "Play Search Netflix Error", "Unable to locate searchTab page element.  Did netflix change their site?", 5)
   _IEQuit($oIE)
   Exit
EndIf

_IEAction($oSearchBox, "click")
sleep(500)
Send($CmdLine[1])
Send("{ENTER}")

Sleep (2000)

Local $oCard = _IEGetObjById($oIE,"title-card-0-0")
if @error Then
   MsgBox(0, "Play Search Netflix Error", "Sorry, no shows found.", 5)
   _IEQuit($oIE)
   Exit
EndIf

_IENavigate($oIE, $oCard.childnodes.item(0).childnodes.item(0).href)
Sleep(5000)
MouseMove(500,500)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...