Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
on run
# заменить на свой токен
set TOKEN to "2d1da421fdd3404318e81c0a0442105e"
# адрес альбома куда загружать фотографии
set ALBUM to "http://api-fotki.yandex.ru/api/users/mylogin/photos/"
tell application "Finder"
set selectedFiles to (get selection)
if (count of selectedFiles) > 0 then
repeat with i from 1 to the count of selectedFiles
set filePath to POSIX path of (item i of selectedFiles as alias)
set responseCode to do shell script "curl -sL -w %{http_code} --header \"Authorization: FimpToken realm=\"fotki.yandex.ru\", token=" & TOKEN & "\" -F \"image=@" & filePath & "\" --request POST " & ALBUM & " -o /dev/null"
if (responseCode is not "201") then
display alert "Произошла ошибка:" message "Не удалось загрузить: " & filePath
end if
end repeat
display notification "Загрузка картинок завершена" with title "fotki.yandex.ru"
end if
end tell
end run
http://api-fotki.yandex.ru/api/users/mylogin/album/200491/photos/
mount volume "https://webdav.yandex.ru:443"
Служба Automator, загружающая изображения на Яндекс.Фотки