Skip to content

Instantly share code, notes, and snippets.

@pbelskiy
Last active April 27, 2025 12:15
Show Gist options
  • Save pbelskiy/ecfcfc8b09196ba1a22cdc5c84322f43 to your computer and use it in GitHub Desktop.
Save pbelskiy/ecfcfc8b09196ba1a22cdc5c84322f43 to your computer and use it in GitHub Desktop.
set numberOfSwipes to 20000
--- ---------------------------------------------------------------------------------
---
--- IF SAFARI NOT OPEN, OPEN SAFARI AND LOAD URL
--- IF SAFARI OPEN, OPEN NEW TAB AND LOAD URL
---
tell application "Safari"
if not (exists (document 1)) then
tell application "Safari" to activate
my open_new_window()
set the URL of document 1 to "http://www.tinder.com/"
else
if (exists (URL of document 1)) then
my open_new_tab()
end if
tell application "Safari" to activate
set the URL of document 1 to "http://www.tinder.com/"
end if
end tell
--- ---------------------------------------------------------------------------------
---
--- DELAY SOME TIME TO LOAD THE PAGE
---
delay 5
--- ---------------------------------------------------------------------------------
---
--- THIS IS THE ACTUAL SWIPING (key code 124 is arrow pointing right)
---
activate application "Safari"
repeat numberOfSwipes times
-- ignore super like (esc)
tell application "System Events" to key code 53
-- 1 in about 3 profiles, show the profile to make it more human-like
set randomNr to random number from 1 to 3
if randomNr < 2 then
tell application "System Events" to key code 126 -- arrow up
-- delay a random time to make it more human-like
set delayTime to random number from 0.3 to 2
delay delayTime
-- Now browse the pictures (1 to 4 swipes, random delay between swipes)
set randomNr to random number from 1 to 4
repeat randomNr times
tell application "System Events" to key code 49 -- space bar
set delayTime to random number from 0.3 to 2
delay delayTime
end repeat
end if
-- make choice
set randomNr to random number from 1 to 100
if randomNr < 2 then
-- swipe left (dislike)
tell application "System Events" to key code 123
else
-- swipe right (like)
tell application "System Events" to key code 124
end if
-- delay a random time to make it more human-like
set delayTime to random number from 0.4 to 4
delay delayTime
-- update tab becasue it freezes when long time using
set randomNr to random number from 1 to 50
if randomNr = 1 then
my refresh_tab()
delay 5
end if
end repeat
--- ---------------------------------------------------------------------------------
--- ---------------------------------------------------------------------------------
--- ---------------------------------------------------------------------------------
---
--- SOME FUNCTIONS, DON'T WORRY ABOUT THESE ONES
---
on open_new_window()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Window" of menu "File" of menu bar 1
end tell
end tell
end open_new_window
on open_new_tab()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
end open_new_tab
on refresh_tab()
tell application "Safari"
set docUrl to URL of document 1
set URL of document 1 to docUrl
end tell
end refresh_tab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment