· 7 years ago · Dec 07, 2018, 07:12 PM
1tell application "Google Chrome"
2 open location "https://www.spotify.com/de/signup/?forward_url=https%3A%2F%2Fwww.spotify.com%2Fde%2Faccount%2Foverview%2F"
3
4 set randomString to ""
5
6 repeat with x from 1 to 20
7 set randomChar to ASCII character (random number from 97 to 122)
8 set randomString to randomString & randomChar
9 end repeat
10 log randomString
11
12 delay 0.6
13 set the_state to missing value
14 repeat until the_state is "complete"
15 set the_state to execute front window's active tab javascript "document.readyState"
16 log "busy"
17 delay 0.2
18 end repeat
19 log "complete"
20
21 execute front window's active tab javascript "document.forms[1].elements[5].elements[0].value = '" & randomString & "@gmail.com'"
22 execute front window's active tab javascript "document.forms[1].elements[5].elements[1].value = '" & randomString & "@gmail.com'"
23 execute front window's active tab javascript "document.forms[1].elements[5].elements[2].value = 'abcdef@afSfg'"
24 execute front window's active tab javascript "document.forms[1].elements[5].elements[3].value = 'Anonymous'"
25 execute front window's active tab javascript "document.forms[1].elements[5].elements[4].value = '12'"
26 execute front window's active tab javascript "document.forms[1].elements[5].elements[5].value = '11'"
27 execute front window's active tab javascript "document.forms[1].elements[5].elements[6].value = '1999'"
28 execute front window's active tab javascript "document.forms[1].elements[5].elements[7].click()"
29 execute front window's active tab javascript "document.forms[1].elements[18].click()"
30
31 set the_state to missing value
32 repeat until the_state is "https://www.spotify.com/de/download/mac/"
33 set the_state to (execute front window's active tab javascript "location.href")
34 log "not ready"
35 delay 0.2
36 end repeat
37
38 open location "https://open.spotify.com/album/5biPTOwe2FxrYS6Hvvff0C"
39 delay 0.6
40
41 set the_state to missing value
42 repeat until the_state is "complete"
43 set the_state to execute front window's active tab javascript "document.readyState"
44 log "busy"
45 delay 0.2
46 end repeat
47 log "loaded"
48 delay 2.0
49
50 set playing to missing value
51 repeat until playing is 0
52 execute front window's active tab javascript "Array.from(document.getElementsByClassName('tracklist-name ellipsis-one-line')).find((e)=>e.textContent.indexOf('Emma')!=-1).parentNode.parentNode.parentNode.children[0].children[0].click()"
53 delay 0.5
54 set playing to execute front window's active tab javascript "document.getElementsByClassName('track-info__name ellipsis-one-line')[0].textContent.indexOf('Emma')"
55 log "not playing"
56 delay 0.2
57 end repeat
58
59 delay 3
60
61 execute front window's active tab javascript "document.getElementsByClassName('control-button spoticon-repeat-16')[0].click()"
62 delay 0.5
63 execute front window's active tab javascript "document.getElementsByClassName('control-button spoticon-repeat-16')[0].click()"
64 delay 10
65 repeat until playing is 1
66 execute front window's active tab javascript "document.getElementsByClassName('control-button spoticon-skip-back-16')[0].click()"
67 delay 50
68 end repeat
69
70
71
72end tell