Created
May 18, 2020 20:45
-
-
Save m0pfin/d202edd814f612672e7a7ab740778244 to your computer and use it in GitHub Desktop.
AppleScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Достаём токен из AdsManager FB, в INIDGO | |
set myLink to "https://facebook.com/adsmanager" | |
tell application "Chromium" | |
activate | |
open location myLink | |
delay 5 | |
execute active tab of window 1 javascript "var re = new RegExp('access_token\"?:\"(.*?)\"'); | |
var m = document.documentElement.innerHTML.match(re); | |
navigator.clipboard.writeText(m[1]) | |
.then(() => { | |
// Получилось! | |
alert('Токен скопирован в буффер обмена!'); | |
}) | |
.catch(err => { | |
alert('Ошибка: ', err); | |
});" | |
delay 1 | |
end tell | |
-- Добавляем токен в ФБтул | |
activate | |
display dialog "Введите имя аккаунта" buttons {"Добавить"} default answer "" | |
set nameAcc to text returned of result | |
set token to (the clipboard) | |
do shell script "curl --location --request POST 'https://fbtool.pro/api/add-account?key=API_KEY_FBTOOL' --form 'token=" & token & "' --form 'name=" & nameAcc & "' --form 'group=YOU_ID'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment