apple icloud suite
1
总安装量
0
周安装量
#47117
全站排名
安装命令
npx skills add https://github.com/rtjowo/apple --skill Apple iCloud Suite
Skill 文档
Apple iCloud Suite
è¿ä¸ª Skill æä¾å¯¹ Apple iCloud ä¸»è¦æå¡çå½ä»¤è¡è®¿é®è½åã
â 宿µéªè¯ç»æ (2026-02-05)
| æå¡ | ç¶æ | å·¥å · | 说æ |
|---|---|---|---|
| ð· ç §ç | â å®å ¨å¯ç¨ | pyicloud / icloudpd | æµè§ç¸åãä¸è½½ç §ç |
| ð¾ iCloud Drive | â å®å ¨å¯ç¨ | pyicloud | æµè§åä¸è½½æä»¶ |
| ð± æ¥æ¾è®¾å¤ | â å®å ¨å¯ç¨ | pyicloud | æ¥çææè®¾å¤ä½ç½®åç¶æ |
| ð æ¥å | â å®å ¨å¯ç¨ | CalDAV (caldavåº) | 读å/å建äºä»¶ (éåºç¨ä¸ç¨å¯ç ) |
| ð å¤å¿å½ | â ï¸ æéæ¯æ | – | Apple Notes æ å ¬å¼ API |
ð è®¤è¯æ¹å¼è¯´æ
â ï¸ éè¦åç°
pyicloud API éè¦ä½¿ç¨ 主å¯ç + åé认è¯ç ï¼ä¸æ¯æåºç¨ä¸ç¨å¯ç ï¼
CalDAV (æ¥å) å¯ä»¥ä½¿ç¨ åºç¨ä¸ç¨å¯ç ã
è®¤è¯æµç¨
from pyicloud import PyiCloudService
import os
# ä¸å½å¤§éç¨æ·è®¾ç½®ç¯å¢åé
os.environ['icloud_china'] = '1'
# 使ç¨ä¸»å¯ç è¿æ¥
api = PyiCloudService('your@email.com', '主å¯ç ', china_mainland=True)
# å¤çåé认è¯
if api.requires_2fa:
code = input("请è¾å
¥ iPhone 䏿¶å°çéªè¯ç : ")
api.validate_2fa_code(code)
print("éªè¯æåï¼")
ð· Part 1: ç §ç (pyicloud) â å·²éªè¯
ååºç¸å
#!/usr/bin/env python3
import os
os.environ['icloud_china'] = '1'
from pyicloud import PyiCloudService
api = PyiCloudService('your@email.com', 'password', china_mainland=True)
# å¤çåé认è¯...
# ååºææç¸å
photos = api.photos
print(f'ç¸åæ°é: {len(photos.albums)}')
for album_name in photos.albums:
print(f'ð {album_name}')
ååºç §ç
# è·åç
§çåº
library = photos.albums['Library']
# ååºæè¿çç
§ç
for i, photo in enumerate(library.photos):
if i >= 10: break
print(f'ð· {photo.filename} | {photo.created}')
ä¸è½½ç §ç
# è·å第ä¸å¼ ç
§ç
photo = next(iter(library.photos))
print(f'æ£å¨ä¸è½½: {photo.filename}')
# ä¸è½½
download = photo.download()
with open(photo.filename, 'wb') as f:
f.write(download.raw.read())
print(f'â
å·²ä¿å: {photo.filename}')
ä½¿ç¨ icloudpd æ¹éä¸è½½
# å®è£
pip install icloudpd
# ä¸è½½ææç
§ç (ä¸å½å¤§é)
icloudpd --directory ~/Pictures/iCloud \
--username your@email.com \
--domain cn
# ä¸è½½æè¿ 100 å¼
icloudpd -d ~/Pictures/iCloud -u your@email.com --recent 100
# æç»åæ¥ (æ¯å°æ¶)
icloudpd -d ~/Pictures/iCloud -u your@email.com --watch-with-interval 3600
ð¾ Part 2: iCloud Drive â å·²éªè¯
æµè§æä»¶
#!/usr/bin/env python3
import os
os.environ['icloud_china'] = '1'
from pyicloud import PyiCloudService
api = PyiCloudService('your@email.com', 'password', china_mainland=True)
# å¤çåé认è¯...
# ååºæ ¹ç®å½
drive = api.drive
for item in drive.dir():
print(f'ð {item}')
# è¿å
¥åç®å½
subfolder = drive['Downloads']
for item in subfolder.dir():
print(f' ð {item}')
ä¸è½½æä»¶
# ä¸è½½æä»¶
file = drive['æä»¶å.pdf']
with file.open(stream=True) as response:
with open('æ¬å°æä»¶.pdf', 'wb') as f:
f.write(response.raw.read())
ð± Part 3: æ¥æ¾è®¾å¤ â å·²éªè¯
ååºææè®¾å¤
#!/usr/bin/env python3
import os
os.environ['icloud_china'] = '1'
from pyicloud import PyiCloudService
api = PyiCloudService('your@email.com', 'password', china_mainland=True)
# å¤çåé认è¯...
# ååºææè®¾å¤
print('ð± æç设å¤:')
for device in api.devices:
print(f' - {device}')
设å¤å®ä½åæä½
# è·åç¹å®è®¾å¤
iphone = api.devices['iPhone']
# è·åä½ç½®
location = iphone.location()
print(f'ä½ç½®: {location}')
# ææ¾å£°é³
iphone.play_sound()
# 丢失模å¼
iphone.lost_device(number='123456789', message='请èç³»æ')
ð Part 4: æ¥å (CalDAV) â å·²éªè¯
æ¥ååè½ä½¿ç¨ CalDAV åè®®ç´æ¥è®¿é® iCloud æ¥åï¼éè¦åºç¨ä¸ç¨å¯ç ã
ð æµè¯ç»æ
ð
æ¥åå表:
1. ð 大麦
2. ð æé â ï¸
3. ð åå©åå©
4. ð æºç¨
5. ð 个人
6. ð å·¥ä½
å
± 6 个æ¥å
ð
ä»å¤©çäºä»¶ (2026-02-05):
ð åsissiåèéå±±
ð 2026-02-05 20:00-21:00
ä½¿ç¨ icloud_calendar.py
# 设置ç¯å¢åé
export ICLOUD_USERNAME="your@email.com"
export ICLOUD_APP_PASSWORD="xxxx-xxxx-xxxx-xxxx" # åºç¨ä¸ç¨å¯ç ï¼
# ååºæ¥å
python icloud_calendar.py list
# æ¥çä»å¤©äºä»¶
python icloud_calendar.py today
# æ¥çæªæ¥ N 天
python icloud_calendar.py week 7
# å建äºä»¶
python icloud_calendar.py new 2026-02-10 10:00 11:00 "å¼ä¼"
python icloud_calendar.py new 2026-02-10 "å
¨å¤©äºä»¶"
# æç´¢äºä»¶
python icloud_calendar.py search ä¼è®®
â ï¸ éè¦ï¼æ¥åéè¦åºç¨ä¸ç¨å¯ç
æ¥ååè½ä½¿ç¨ CalDAV åè®®ï¼éè¦åºç¨ä¸ç¨å¯ç ï¼ä¸æ¯ä¸»å¯ç ï¼ï¼
- ç»å½ https://appleid.apple.com
- è¿å ¥ãç»å½ä¸å®å ¨ãâãåºç¨ä¸ç¨å¯ç ã
- ç¹å»ã+ãçææ°å¯ç
- å¤å¶å¯ç ï¼æ ¼å¼:
xxxx-xxxx-xxxx-xxxxï¼
é ç½® vdirsyncer (å¯é)
å建 ~/.config/vdirsyncer/configï¼
[general]
status_path = "~/.local/share/vdirsyncer/status/"
[pair icloud_calendar]
a = "icloud_calendar_remote"
b = "icloud_calendar_local"
collections = ["from a", "from b"]
conflict_resolution = "a wins"
[storage icloud_calendar_remote]
type = "caldav"
url = "https://caldav.icloud.com/"
username = "your@email.com"
# 使ç¨åºç¨ä¸ç¨å¯ç
password.fetch = ["command", "cat", "~/.config/vdirsyncer/icloud_password"]
[storage icloud_calendar_local]
type = "filesystem"
path = "~/.local/share/vdirsyncer/calendars/"
fileext = ".ics"
é ç½® khal
å建 ~/.config/khal/configï¼
[calendars]
[[icloud]]
path = ~/.local/share/vdirsyncer/calendars/*
type = discover
[default]
default_calendar = Home
highlight_event_days = True
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
æ¥åå½ä»¤
# 馿¬¡è®¾ç½®
vdirsyncer discover
vdirsyncer sync
# æ¥çäºä»¶
khal list # ä»å¤©
khal list today 7d # æªæ¥7天
# å建äºä»¶
khal new 2026-01-15 10:00 11:00 "ä¼è®®"
# 忥
vdirsyncer sync
ð§ 宿´ Python èæ¬
icloud_tool.py
#!/usr/bin/env python3
"""
Apple iCloud å½ä»¤è¡å·¥å
·
ç¨æ³: python icloud_tool.py [photos|drive|devices] [åå½ä»¤]
"""
import sys
import os
os.environ['icloud_china'] = '1'
from pyicloud import PyiCloudService
def get_api():
"""è¿æ¥ iCloud"""
username = os.environ.get('ICLOUD_USERNAME') or input("Apple ID: ")
password = os.environ.get('ICLOUD_PASSWORD') or input("å¯ç : ")
api = PyiCloudService(username, password, china_mainland=True)
if api.requires_2fa:
print("\nð éè¦åé认è¯")
print("请æ¥ç iPhone ä¸çéªè¯ç ")
code = input("éªè¯ç : ")
if not api.validate_2fa_code(code):
print("â éªè¯å¤±è´¥")
sys.exit(1)
print("â
éªè¯æå!\n")
return api
def cmd_photos(api, args):
"""ç
§çå½ä»¤"""
photos = api.photos
if not args or args[0] == 'albums':
print('ð· ç¸åå表:')
for name in photos.albums:
print(f' ð {name}')
elif args[0] == 'list':
limit = int(args[1]) if len(args) > 1 else 10
library = photos.albums['Library']
print(f'ð· æè¿ {limit} å¼ ç
§ç:')
for i, p in enumerate(library.photos):
if i >= limit: break
print(f' {i+1}. {p.filename} | {p.created}')
elif args[0] == 'download':
index = int(args[1]) - 1 if len(args) > 1 else 0
library = photos.albums['Library']
for i, p in enumerate(library.photos):
if i == index:
print(f'æ£å¨ä¸è½½: {p.filename}')
dl = p.download()
with open(p.filename, 'wb') as f:
f.write(dl.raw.read())
print(f'â
å·²ä¿å: {p.filename}')
break
def cmd_drive(api, args):
"""iCloud Drive å½ä»¤"""
drive = api.drive
if not args or args[0] == 'list':
print('ð¾ iCloud Drive:')
for item in drive.dir():
print(f' ð {item}')
elif args[0] == 'cd' and len(args) > 1:
folder = drive[args[1]]
print(f'ð {args[1]}:')
for item in folder.dir():
print(f' ð {item}')
def cmd_devices(api, args):
"""设å¤å½ä»¤"""
print('ð± æç设å¤:')
for d in api.devices:
print(f' - {d}')
def main():
if len(sys.argv) < 2:
print("""
ð Apple iCloud å½ä»¤è¡å·¥å
·
ç¨æ³: python icloud_tool.py <å½ä»¤> [åæ°]
å½ä»¤:
photos albums ååºç¸å
photos list [N] ååºæè¿ N å¼ ç
§ç
photos download N ä¸è½½ç¬¬ N å¼ ç
§ç
drive list ååº iCloud Drive
drive cd <æä»¶å¤¹> è¿å
¥æä»¶å¤¹
devices ååºè®¾å¤
ç¯å¢åé:
ICLOUD_USERNAME Apple ID
ICLOUD_PASSWORD å¯ç
""")
sys.exit(0)
api = get_api()
cmd = sys.argv[1]
args = sys.argv[2:]
if cmd == 'photos':
cmd_photos(api, args)
elif cmd == 'drive':
cmd_drive(api, args)
elif cmd == 'devices':
cmd_devices(api, args)
else:
print(f'æªç¥å½ä»¤: {cmd}')
if __name__ == '__main__':
main()
ð å¿«éåè
pyicloud (éè¦ä¸»å¯ç + 2FA)
| åè½ | 代ç |
|---|---|
| è¿æ¥ | api = PyiCloudService(email, pwd, china_mainland=True) |
| ç §çç¸å | api.photos.albums |
| ç §çå表 | api.photos.albums['Library'].photos |
| ä¸è½½ç §ç | photo.download().raw.read() |
| iCloud Drive | api.drive.dir() |
| 设å¤å表 | api.devices |
CalDAV (使ç¨åºç¨ä¸ç¨å¯ç )
| åè½ | å½ä»¤ |
|---|---|
| 忥 | vdirsyncer sync |
| æ¥åå表 | khal list today 7d |
| å建äºä»¶ | khal new DATE TIME "æ é¢" |
â ï¸ æ³¨æäºé¡¹
- pyicloud 使ç¨ä¸»å¯ç ï¼ä¸æ¯æåºç¨ä¸ç¨å¯ç ï¼éè¦åé认è¯
- CalDAV 使ç¨åºç¨ä¸ç¨å¯ç ï¼å¨ appleid.apple.com çæ
- ä¸å½å¤§éç¨æ·ï¼
- pyicloud:
china_mainland=Trueæos.environ['icloud_china'] = '1' - icloudpd:
--domain cn
- pyicloud:
- ä¼è¯ç¼åï¼é¦æ¬¡è®¤è¯åä¼è¯ä¼ä¿åå¨
~/.pyicloud/ - å¤å¿å½éå¶ï¼Apple Notes 没æå ¬å¼ APIï¼å»ºè®®ä½¿ç¨ iCloud.com ç½é¡µç