feat: initialize sunrise with 100-player shared rooms
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Save a small set of publicly displayed, recent structure reference photos."""
|
||||
import html
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
root=Path(__file__).resolve().parents[1]
|
||||
page=(root/'.tools/sunrise-photo-page.html').read_text(encoding='utf-8')
|
||||
records=[]
|
||||
patterns=['송신소를 배경으로','송신소의 철탑 4개','안전목책이 설치된','연주대 전망데크에서 드디어','기상레이더 관측소 좌측 뒤로','관악산정상을 출발해 북쪽','중간의 전망데크에서 진행 방향']
|
||||
for index,pattern in enumerate(patterns,1):
|
||||
at=page.find(pattern)
|
||||
figures=list(re.finditer(r'<figure\b.*?</figure>',page[:at],re.S))
|
||||
if at<0 or not figures:
|
||||
continue
|
||||
figure=figures[-1].group()
|
||||
url=html.unescape(re.search(r'<img[^>]+src="([^"]+)"',figure).group(1))
|
||||
name=f'recent-{index:02d}.jpg'
|
||||
target=root/'data/references/summit/photos'/name
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as response:
|
||||
data=response.read()
|
||||
if not data.startswith(b'\xff\xd8'):
|
||||
raise ValueError('Not JPEG')
|
||||
target.write_bytes(data)
|
||||
records.append({'file':name,'title':f'2026-06-03 structure reference {index}','status':'downloaded','source':'https://ydk5118.tistory.com/16906972','download_url':url,'metadata':{'Artist':{'value':'칠갑산 사랑'},'DateTimeOriginal':{'value':'2026-06-03 (게시글 산행일 기준)'},'LicenseShortName':{'value':'공개 재사용 허락 미확인 — 로컬 참고용, 앱 배포 자산으로 사용하지 않음'}}})
|
||||
print(name,'downloaded',flush=True)
|
||||
except Exception as error:
|
||||
print(name,str(error),flush=True)
|
||||
time.sleep(1)
|
||||
(root/'data/references/summit/photos/recent-downloads.json').write_text(json.dumps(records,ensure_ascii=False,indent=2),encoding='utf-8')
|
||||
Reference in New Issue
Block a user