← back to Crazy News Channel

daily-edition/__pycache__/build.cpython-314.pyc

201 lines

+
�Y�j�U���Rt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RI	t	^RI
t]PP]PP]44t]P"P%R4;'g]PP]4t]	PP)^]PP+]PP]4R44^RItR]nR]n]PP5]P"P%RR44t]!]P"P%RR	44t]!]P"P%R
R	44t]PP+]R4t]PP+]R4t ^t!]P"P%R
R4PER4Uu.uFq'gKVNK	upt#]P"P%RR4t$]P"P%RR4t%]P"P%RR4t&Rt'Rt(Rt)]PT!R]PV4t,]PT!R]PV4t-Rt.]/!RPE44t0Rt1Rt2Rt3R t4R!t5R"t6R#t7R$t8]!3R%lt9R&t:R't;R(t<R)t=]PT!R*4t>]PT!R+]PV4t?R,t@R-tA.R6OtBR.tC]/!4tDR/tER0tFR1tGR2tHR3tIR4tJ]KR58Xd]	P�!]J!44R#R#uupi)7uP24 Daily Edition (TK-12354) — ALL of today's news + the TOP 6 stories, each with an
original editorial-ink cartoon signed "Shadow Man" (the conrad.agentabrams.com house style).

  python3 daily-edition/build.py              # build/refresh today's edition
  python3 daily-edition/build.py --no-images  # $0: list + concepts only, no Replicate calls
  python3 daily-edition/build.py --dry        # print the top-6 picks and exit, writes nothing

News source: the allnewsdaily wire (~/Projects/allnewsdaily/data/wire.json, rebuilt every
10 min by com.steve.allnewsdaily-wire-push), falling back to this repo's real-news-data.js
(Google News RSS) when the wire is missing or older than WIRE_MAX_AGE_H.

Top 6 are LOCKED on the first run of the day: later same-day runs refresh the all-news list
for $0 and never regenerate illustrations (so the daily spend is ~6 x $0.003 = $0.018).

Illustrations: concept (gag + purely visual scene) from a local LLM ($0 — Mac1 Ollama
qwen3:14b, then the local MLX server), falling back to a deterministic keyword template;
image = Replicate flux-schnell (~$0.003) -> ink post-process -> "Shadow Man" signature.
Hard daily cap P24_EDITION_CAP_USD (default 0.10), summed from ~/.claude/cost-ledger.jsonl
(app=p24-daily-edition); every paid call is logged via the cost-tracker skill.

Standing rules honoured: never name/depict real people/brands in a cartoon (invented
archetypes only, DENY + proper-noun backstops); never name the research cartoonist anywhere
(BANNED); every rendered cartoon carries the "Shadow Man" signature.
N�P24_SITE_DIR�daily-cartoonszp24-daily-editionc�T�\\PPRR44#)�P24_EDITION_CAP_USDz0.10)�float�os�environ�get���J/Users/macstudio3/Projects/crazy-news-channel-daily/daily-edition/build.py�<lambda>r
"s��E�"�*�*�.�.�)>��G�Hr�
P24_WIRE_JSONz&~/Projects/allnewsdaily/data/wire.json�P24_WIRE_MAX_AGE_H�36�P24_ITEM_MAX_AGE_H�dailyzdaily-edition-data.js�P24_EDITION_OLLAMAzhttp://192.168.1.133:11434�,�P24_EDITION_OLLAMA_MODELz	qwen3:14b�P24_EDITION_MLXzhttp://127.0.0.1:8000�P24_EDITION_MLX_MODELz.mlx-community/Qwen3-30B-A3B-Instruct-2507-4bitz
Shadow Manzmbold black ink editorial cartoon, heavy brush line, crosshatching, stark black and white, single panel satirez� Invented anonymous caricature figures only. No color, no text, no letters, no words, no speech bubbles, no caption, no watermark, no signature.z.conrad|in the style of|style of [A-Z]|pulitzera\b(trump|biden|harris|obama|pelosi|mcconnell|schumer|desantis|newsom|musk|bezos|zuckerberg|putin|xi jinping|zelensky|netanyahu|vance|aoc|ocasio|sanders|clinton|bush|reagan|kennedy|democrat|republican|gop|maga|google|apple|amazon|microsoft|meta|tesla|oracle|nvidia|openai)\bz8/System/Library/Fonts/Supplemental/Bradley Hand Bold.ttfz�a an the of to in on for and or at by with from as is are was be it its this that new says after over into amid report reports than more about up out who what how why will canc���V'gR#RFYp\PPVP4V4P\PP
4u#	\PPVPRR44P\PP
4# \dK�i;i \dR#i;i)N�Zz+00:00)z%a, %d %b %Y %H:%M:%S %zz%a, %d %b %Y %H:%M:%S %Z)	�datetime�strptime�strip�
astimezone�timezone�utc�	Exception�
fromisoformat�replace)�s�fmts& r�_parse_dater%=s�����G��	��$�$�-�-�a�g�g�i��=�H�H��IZ�IZ�I^�I^�_�_�H�
�� � �.�.�q�y�y��h�/G�H�S�S�T\�Te�Te�Ti�Ti�j�j���	��	������s%�AC�+AC�C�C�C"�!C"c���\P!RRT;'gR\PR7P4pV'd&VR,P	4VR,,#T#)z(^\s*(report|breaking|update|live)\s*:\s*�)�flags:N�N:r)NN)�re�sub�Ir�upper)�ts&r�clean_topicr/KsJ��
���:�B����R�r�t�t�T�Z�Z�\�A�&'�A�b�E�K�K�M�A�b�E�!�.�Q�.rc��R\P!T;'gRP44P4R,,#)zd-r':N�
N)�hashlib�sha1�encode�	hexdigest)�links&r�story_idr7Ps3���'�,�,��
�
��2�2�4�5�?�?�A�#�F�F�Frc���\P!\\44p\
TPR44pT'd]\PP\PP4T,
P4\R,8�d!\RTPR4R24R#.pTPR4pT'd6TPR4'dTP\TR	R
RR74TPR
4;'g.F�pTPR4;'g.FjpTP\YePR4;'gTPR4;'gRTPR4;'gRR74Kl	K�	RTP!4T3# \dp\RTR24Rp?R#Rp?ii;i)zK-> (source_label, updated_iso, [items]) or None when missing/stale/invalid.z[news] wire unavailable (z); falling backN�	updatedAt�z[news] wire stale (updatedAt=�splashr6z	Top story�topT)�section�section_keyr;�columns�items�title�key�News�news)r=r>zallnewsdaily wire)�json�load�open�WIREr �printr%r	r�nowrr�
total_seconds�WIRE_MAX_AGE_H�append�dict�	isoformat)�w�e�updr@�sp�col�its       r�	load_wirerVTs���K��I�I�d�4�j�!���a�e�e�K�(�
)�C��8�$�$�(�(��):�):�)>�)>�?�#�E�T�T�V�Yg�jn�Yn�n�
�-�a�e�e�K�.@�-A��Q�R�[_��E�	
���x��B�	�b�f�f�V�n�n�
���T�"�k�u�T�R�S��u�u�Y��%�%�2�%���'�'�'�"�(�(�b�(�B��L�L��b�'�'�'�*:�*V�*V�c�g�g�e�n�*V�*V�PV�dg�dk�dk�lq�dr�d|�d|�v|�}�~�)�&���
�
���6�6���K�
�)�!��O�<�=�d��K�s�#G�G6�G1�1G6c��\P!R\PP	\
RR4.RR^<R7pVP^8wd \RVPR,24h.p\P!VP4F�pVPR4R8wdKTPR	VPR
4;'gRRVPR
4RVPR4RVPR4RRRVPR4;'gR.^,P4RR/4K�	RRV3#)�noderzextract_stories.mjsT)�capture_output�text�timeoutz+[news] no wire AND extract_stories failed: :Ni,N�sourcez	real-news�outlet�
sourceNamer'r6�	sourceUrl�topic�headline�date�publishedAt�imageNr=�tagsrCr>�realzGoogle News RSS (fallback))�
subprocess�runr�path�join�SITE�
returncode�
SystemExit�stderrrE�loads�stdoutr	rMrA)�pr@�as   r�load_realnews_fallbackrsgs�����������T�3C�EZ� [�\�&*��r�	C�A��|�|�q���F�q�x�x�PT�~�FV�W�X�X��E�
�Z�Z����
!���5�5��?�k�)��
���h����l� 3� 9� 9�r�6�1�5�5��CU�W^�`a�`e�`e�fp�`q��a�e�e�M�2�G�T��!�%�%��-�";�";�F�8�Q�!?�!E�!E�!G��X^�`�	a�"�(��u�4�4rc�$�\PP\PP4p\	4.r2VEFFpVPR4\
VPR44reV'dV'dWR9dKF\VPR44pV'd)W,
P4\R,8�dK�VPV4TPR\V4RTRTRVPR4;'gRR	V'dVP4MR
RVPR4;'gRR
VPR
4;'gRR\VPR44/4EKI	V#)r6r`rbr:�idra�urlr]r'�	publishedNr=rCr>rDr;)rrJrr�setr	r/r%rK�ITEM_MAX_AGE_H�addrMr7rO�bool)r@rJ�seen�outrUr6r`�ds&       r�	normalizervs/��
�
�
�
�
�� 1� 1� 5� 5�
6�C���r�#����f�f�V�n�k�"�&�&��/�&B�e��5�D�L������v��'���#�'�(�(�*�^�d�-B�B��������
�
�D�(�4�.�*�e�U�D�(�TV�TZ�TZ�[c�Td�Tj�Tj�hj��!������y�"�&�&�QZ�J[�Je�Je�_e�!�2�6�6�-�#8�#B�#B�F�H�d�SU�SY�SY�Zb�Sc�Nd�f�	g���Jrc�8�VP4PRR4PRR4p\P!RV4Uu0uFDq\9gK\V4^8�gK!\V4^8�dVP
R4MTkKF	up#uupi)u’r'�'z	[a-z0-9]+r#)�lowerr"r*�findall�STOP�len�rstrip)r#rPs& r�tokensr��s��	���	���%��$�,�,�S�"�5�A�8:�
�
�<�QR�8S�t�8S�1�`d�Wd�.�il�mn�io�rs�is�.�S��V�a�Z�A�H�H�S�M�Q�.�8S�t�t��ts�
B�
B�-'Bc��\V4\V4r2\W#,4pV^8�;'g&V\^\W#,44,R8�#)�g333333�?)r�r��max)rr�b�ta�tb�shareds&&   r�
same_storyr��sE��
�A�Y��q�	��
���\�F��Q�;�>�>�&�3�q�#�b�g�,�#7�7�3�>�>rc�4a�/pVF<oSR,'dKVPSR,.4PS4K>	VP4FpVPRRR7K	VUu.uFqDR,'gKVNK	pp\	VP44p\V4'd6VF-pV'gK
VPVP
^44K/	KF..r�VF�o\
;QJdV3RlV	4F'gKRM	RM!V3RlV	44'dV	PSR,4K]V	PSR,4VPS4\V4V8�gK�V#	V#uupi)	z�Splash first, then round-robin across sections (newest first in each), skipping
near-duplicates of an already-picked (or already-skipped) story, so one big story
covered by five outlets fills ONE slot, not five.r;r>c�(�VR,;'gR#)rwr'r
)�xs&rr
�pick_top.<locals>.<lambda>�s��Q�{�^�1�1�r�1rT)rB�reversec3�J<"�TFp\SR,V4x�K	R#5i)raN)r�)�.0�hrUs& �r�	<genexpr>�pick_top.<locals>.<genexpr>�s����A�j��z�"�Z�.�!�,�,�j�s� #Fra)�
setdefaultrM�values�sort�list�any�popr�)
r@�n�by_sec�vrU�order�queues�q�picked�
seen_headss
&&  `     r�pick_topr��sB����F���
�h�<�<�����"�]�+�R�0�7�7��;���]�]�_��	���1�4��@���0�%�B�h�<�<�R�R�%�E�0�
�&�-�-�/�
"�F�

�f�+�+��A��q����Q�U�U�1�X�&���R�J����3�A�j�A�3�3�3�A�j�A�A�A����b��n�-�����"�Z�.�)��
�
�b���v�;�!����M���M��
1s�5F�
Fc��RVR,R2#)z�/no_think You are the gag writer for P24, a satirical news site. Invent ONE ORIGINAL single-panel
editorial-cartoon concept about the TOPIC of this real headline, generalized so it stands alone as a gag.
HEADLINE: rau�
Rules: invented anonymous archetypes only ("a sweating official", "a committee of identical bureaucrats",
"a tiny homeowner"); NEVER name or depict any real person, party, company, brand, country, city or
organization from the headline — use a generic stand-in for the same role; one strong absurd visual
metaphor; nothing hateful. The drawing must contain NO written words, signs, labels, numbers, dates
or quoted text of any kind — tell the joke with the picture alone.
Return ONLY JSON: {"title":"3-6 words","caption":"one witty line, max 16 words","scene":"40-80 word purely
visual description: foreground figure(s), action, background, the absurd detail"}r
)�storys&r�concept_promptr��s$������
�S�	V�	Vrc
�\�R\RVRRRRRRRR	R
//p\PPVR2\P
!V4P
4RR
/R7p\P!\P!\PPV^xR74R,4#)�model�prompt�formatrE�streamF�options�temperatureg�?�num_predicti�z
/api/generate�Content-Type�application/json��data�headers�r[�response)
�OLLAMA_MODEL�urllib�request�RequestrE�dumpsr4rorF�urlopen)�hostr��body�rs&&  r�_ollamar��s����\�8�V�X�v�x�QV��
�t�]�C�@�B�D������$��}�5�D�J�J�t�<L�<S�<S�<U�(6�8J�'K�	�	M�A��:�:�d�i�i���� 6� 6�q�#� 6� F�G�
�S�T�Trc���R\RRRRV/.RRRR/p\PP\R	2\
P!V4P4R
R/R7p\
P!\PPV^R
74R,^,R,R,p\
P!W3PR4VPR4^,4#)r��messages�role�user�content�
max_tokensi�r�g�������?z/v1/chat/completionsr�r�r�r��choices�message�{�})
�	MLX_MODELr�r�r��MLXrEr�r4rFr�ro�index�rindex)r�r�r��txts&   r�_mlxr��s����Y�
�f�f�i��-P�,Q�S_�ad�fs�ux�y�D������#��&:�;�$�*�*�T�BR�BY�BY�B[�(6�8J�'K�	�	M�A�
�)�)�F�N�N�*�*�1�b�*�9�
:�9�
E�a�
H��
S�T]�
^�C��:�:�c�)�)�C�.�#�*�*�S�/�A�*=�>�?�?rc���\P!RV4p\V4UUu.uF/wr#V^8�gKV^,P4'gK-VNK1	ppp\	V4^8�d2\	V4\	V4^,
,R8�d\4#VUu0uF4p\	V4^8�gKVP
R4P4kK6	up\,
#uuppiuupi)z�Capitalized non-initial words of a SENTENCE-case headline. Title-case headlines capitalize
everything, so there the check is skipped (the prompt rule + DENY list still apply).u[A-Za-z][A-Za-z'’.-]+g�?u.’')	r*r��	enumerate�isupperr�rxrr�r�)ra�words�irP�capss&    r�proper_nounsr��s���
�J�J�1�8�<�E�#�E�*�G�*�$�!�a�!�e�A��!�����A�A�*�D�G�
�5�z�A�~�#�d�)�s�5�z�A�~�6��<��u��.2�A�d��c�!�f�q�j�$�A�G�G�G��"�"�$�d�A�D�H�H��H��Bs�C+�C+�C+�#C1�:#C1u5(?:^|(?<=[\s(]))["'“‘][^"'”’]{1,80}["'”’]zj\b(sign|signs|banner|label|labels|placard|headline|reads|reading|written|lettering|words?|slogan|poster)\bc��\P!RVP44Uu.uFHq'gK\P	V4'dK)\
P	V4'dKFVNKJ	ppRP
V4#uupi)zQDrop sentences that would make flux paint lettering (quoted text, signs, labels).z
(?<=[.!?])\s+� )r*�splitr�QUOTED�search�TEXTYrj)�scener��keeps&  r�scrub_scener��sa���x�x� 0�%�+�+�-�@�w�@�!�A�A�f�m�m�\]�N^�A�gl�gs�gs�tu�gv�A�A�@�D�w��8�8�D�>���xs�	B	�B	�B	�0B	c�aa�\;QJdV3RlR4F'dKRM	RM!V3RlR44'gR#\SR,4SR&\SR,P44^8dR#RP	V3RlR44p\
P
V4'g\P
V4'dR#VP4o\;QJd9V3Rl\VR,44F'gKR'*#	R'*#!V3Rl\VR,444'*#)	c3�<"�TFCp\SPV4\4;'dSV,P4x�KE	R#5i�N)�
isinstancer	�strr�r��k�cs& �rr�� valid_concept.<locals>.<genexpr>�s7����a�C`�a�z�!�%�%��(�C�(�9�9�Q�q�T�Z�Z�\�9�C`�s
�*A� Ar�FTr�c3�6<"�TFpSV,x�K	R#5ir�r
r�s& �rr�r��s����@�"?�Q�A�a�D�D�"?�s�c3�<"�TF>p\P!R\P!V4,R,S4x�K@	R#5i)z\bN)r*r��escape)r�rq�lows& �rr�r��s3����i�Ih�A�2�9�9�U�R�Y�Y�q�\�1�E�9�3�?�?�Ih�s�AA	ra)rA�captionr�)�allr�r�r�rj�DENYr��BANNEDr�r�r�)r�r��blobr�sf& @r�
valid_conceptr��s�����3�a�C`�a�3�3�3�a�C`�a�a�a���Q�w�Z�(�A�g�J�
�1�W�:������#���8�8�@�"?�@�@�D��{�{�4���F�M�M�$�/�/��
�*�*�,�C��s�i��V[�\f�Vg�Ih�i�s�s�i�i�s�i�i�s�i��V[�\f�Vg�Ih�i�i�i�irc	��VR,P4p\F.wr#rE\P!W!4'gK$RVRVRVRR/u#	RRRRRRRR/#)	rarAr�r��engine�templatezFilm at Elevenz2Details are developing, as they always seem to be.zza harried newsman at a desk buried under an avalanche of paper headlines, only his hand visible holding a coffee cup aloft)r��	TEMPLATESr*r�)r�r��rxrA�capr�s&     r�template_conceptr�so��
�j����!�A�!*���3�
�9�9�R����U�I�s�G�U�H�j�Y�Y�"+�
�%�y�2f��R��j�"�"rc
�a�\V4o\Uu.uFpRV2V3V3Rll3NK	upRV3Rl3.,F�wr#V\9dK\^4F�pV!4p\YP4'dNRTR,P4RTR,P4R
TR
,P4RT/uu#\
RTRT^,R24K�	K�	\V4#uupi \P
d7p\
RTRT^,R\T4R,24Rp?K�Rp?i\dDp\
RTR	\T4R
,24\PT4Rp?EKIRp?ii;i)zollama:c�<�\VS4#r�)r�)r�rqs&�rr
�concept_for.<locals>.<lambda>s���'�!�Q�-r�mlxc�<�\S4#r�)r��rqs�rr
rs���lp�qr�lsrz  [concept] z bad JSON (try z): :N�PNNz  error, disabling for this run: :N�xNrAr�r�r�z) returned an invalid/unsafe concept (try �))
r��OLLAMA_HOSTS�DEAD_ENGINES�rangerE�JSONDecodeErrorrIr�r rzr�rr�)r�r��name�fn�attemptr�rQrqs&      @r�concept_forrsn����u��A�KW�X�<�a���s�m�q�&?�A�<�X�]b�ds�\t�[u�u�u����<����Q�x�G�
.��D���Q�&�&���7��!1�!1�!3�Y��)��@R�@R�@T���7��!1�!1�!3�X�t�E�E��L���&O�PW�XY�PY�{�Z[�\�]� �v��E�"�"��Y���'�'�
a���T�F�/�'�!�)��C��A��s��}�U�V�X`���
.���T�F�*J�3�q�6�RV�<�.�Y�Z�� � ��&���
.�s/�C/�C4�4F�	+D:�:F�F�6F�Fg�������?c���^RIHpHpVPwr4VP	V4pVP\\^V^,44pVPR\VR7pV^,V^,,
V^,V^,,
r�W8,
V^,,
WI,
V^,,
r�VPV
^
,
V^,
W�,^
,W�,^,.RR7VPW�V^,,
3\VR	R7VPW�V	,^,W�,W�,^,.R	^R7R#)
z_Stamp the "Shadow Man" signature lower-right, in place (house style of conrad.agentabrams.com).)�	ImageDraw�	ImageFont)�font)�fill)rr)r�widthN)�r)��rr)r1r1r1)
�PILrr�size�Draw�truetype�FONT_SIGr��textbbox�	SIGNATURE�	rectanglerZ�line)�artrr�W�Hr~�sf�bb�sw�shr��ys&           r�signr)1s���(��8�8�D�A����s��A�	�	�	�H�c�"�a�2�g�&6�	7�B�	
���F�I�B��	/�B�
��U�R��U�]�B�q�E�B�q�E�M���6�A��G��Q�V�a�2�g�-�q��K�K��R���Q������Q�V�b�[�9��K�P��F�F�A�2�a�5�y�>�9�2�L�F�A��F�F�A�2�v��z�1�6�1�6�A�:�.�\��F�Krc
��^RIHpHpHpVP	\
P!V44pVPVPV44PR4pVPR4pVPR4pVP^^VP^,\VP^,^\,
,434pVP^,R8�dMVP!R\VP^,R,VP^,,434p\#V4VP%VR^TRRR7R	#)
r)�Image�ImageEnhance�ImageOpsg�?c�*�V^�8�d^�#V^(8d^#T#)��r
rs&rr
�ink_and_sign.<locals>.<lambda>Cs���S��#�B�A��F�q�B��Br�RGBi�JPEGT)�quality�optimize�progressiveN)rr+r,r-rG�io�BytesIO�Contrast�	grayscale�enhance�point�convert�cropr�int�BOTTOM_CROP�resizer)�save)�raw�out_pathr+r,r-�im�gr!s&&      r�ink_and_signrF?s���1�1�	���B�J�J�s�O�	$�B����h�0�0��4�5�=�=�c�B�A�	���B�C�A�
�)�)�E�
�C�

�(�(�A�q�#�(�(�1�+�s�3�8�8�A�;�!�k�/�+J�'K�L�
M�C�
�x�x��{�T���j�j�$��C�H�H�Q�K�$�$6����!��$D� E�F�G����I��H�H�X�v�r�D�d�H�Krc���VPR4R\R\2p\P	V4'd\R4h\P!R4\P!RRRVRRR	R
R^\R^R
R//RR7p\P!RRVRVPR424p\P!V^R4pVR,R8wd(\RVR,RVPR424hVR,p\V\4'd
V^,MTp\PP!V^xR7P#4WCR,V3#)�.z. zbanned term in prompt�fluxzNhttps://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions�inputr��aspect_ratioz4:3�
output_format�jpg�output_quality�num_outputs�
megapixels�1T)�prefer_waitzp24 daily edition z pred=rui,�status�	succeededzflux �: �error�outputr�)r��STYLE�
STYLE_TAILr�r��RuntimeError�C�guard�api�log_costr	�pollr�r�r�r�r��read)r��tagr��pr�costr}s&&    r�	gen_imagerdLs?�����S�!�"�"�U�G�1�Z�L�
9�F�
�}�}�V����2�3�3��G�G�F�O�	
���_��(�F�N�E�?�TY�*�B�
�q�,�PS�U�V�cg�
i�B�
�:�:�f� 2�3�%�v�b�f�f�T�l�^�L�M�D�	
����A�s�	�B�	�(�|�{�"��U�2�h�<�.��2�6�6�'�?�2C�D�E�E�
�X�,�C�
�3��(=�(=�c�!�f�3���>�>�!�!�#�s�!�3�8�8�:�D�T�(�F�R�Rrc�$�\P!4pVPRRR7VPRRR7VPRRR7VP4pVP;'g-\
PP
4P4p\4;'g\4pVwrEp\V4pV'g\R4^#\PP\V4p\PPVR4p	\PP!V	4'd \"P$!\'V	44MR	p
V
'd=V
P)R
4'd&V
R
,p\RVR\+V4R
24M=\-V4Uu.uFp\/V4NK	pp\R\+V4RV24\1V^4F8wr�\RV
RVR,RVR,R,RVR,24K:	VP2'd^#\P4!VRR7Rp\1V^4EF�wr�VP)R4'g@\7V4VR&\RV
RVR,R,RVR,R ,R!24R"VR#V
R$VR%,R&2p\PP\8V4p\PP!V4'dW�R'&K�VP:'dVP=R'R	4K�\?VR,R(,R)V
RVR%,24wpppp\AVV4VV,
pVPCVVVV\
P
PE4PG4PR*R+7R,7\R-V
R.VR/
R0V24EK�	VUu0uFq�R%,kK
	pp\
P
PE4PG4PR*R+7pR4TR5TR6T
;'g/P)R6V4R7TR8TR9\PR
TR:VUu.uFp\/VVR%,V9R;7NK	upR<R:\+V4R
\+V4R=\SR>V44/R?\UV^4R@\HPV!4/pV	RA,p\"PX!V\'VRB4^RC7\PZ!VV	4\]RD\P^!\44RRE7p\"PX!RFV/\'\PP\RG4RB44RH\"P`!VRIRJ7,RK,p\'\bRA,RB4PeV4\PZ!\bRA,\b4\RLVRVR<,RMVRNVR/
ROVR@,R/
2
4VR<,R=,\+V48XgVP:'d^#^#uupi \HPJd0p\R-T
R1T24TP=R'R	4R	p?EKKR	p?i\Ld@p\R-T
R2\OT4R3,24TP=R'R	4R	p?EK�R	p?ii;iuupiuupi)Pz--no-images�
store_true)�actionz--dryz--datez/edition date YYYY-MM-DD (default: today, local))�helpuG[news] 0 items after normalize — refusing to publish an empty editionzedition.jsonNr<z[top] locked from first run of rUz storiesz
[top] picked z new stories for z  z. [r=z] ra:N�ZNu — r]T)�exist_okg�conceptz
  [concept] #r�r�z: "rA�"zdaily/�/�-ruz.jpgrdr��#�seconds)�timespec)rd�image_prompt�
prediction_id�image_cost_usd�image_created_atz  [image] #z ok $z.3fz -> z CAP REFUSED: z	 FAILED: :N��Nrb�built_at�
created_atr\�source_updated_at�illustratorr�)r<�counts�illustratedc3�V"�TFqPR4'gK^x�K!	R#5i)rdN)r	)r�r#s& rr��main.<locals>.<genexpr>�s!���Ik�UX�PQ�\a�\a�bi�\j�!�!�UX�s�)�
)�spend_usd_this_run�spend_usd_todayz.tmprP)�indentc3�d"�TF&p\P!RV4'gK"Vx�K(	R#5i)z^\d{4}-\d{2}-\d{2}$N)r*�match)r�r~s& rr�r~�s#���Z�2�!�b�h�h�?U�WX�6Y�A�A�2�s�0�
0)r��datesz
index.jsonu`// AUTO-GENERATED by daily-edition/build.py (TK-12354) — do not hand-edit.
window.P24_DAILY = F)�ensure_asciiz;
z[done] u · source=u · spent this run $z	, today $)3�argparse�ArgumentParser�add_argument�
parse_argsrbr�todayrOrVrsrrIrrirj�OUT_DIR�existsrErFrGr	r�r�rNr��dry�makedirsrrk�	no_imagesr�rdrF�updaterJrr[�CapExceededr r�r�sum�round�spent_today�dumpr"�sorted�listdirr��DATA_JS�write)�aprrrb�src�label�updatedrBr@�day_dir�ed_path�prevr<r#r��spent�img_rel�img_abs�raw_imgrc�pidr�rQ�top_idsrJrU�edition�tmpr��jss                             r�mainr�]s���	�	 �	 �	"�B��O�O�M�,�O�7��O�O�G�L�O�1��O�O�H�#T�O�U�
�
�
��A��6�6�6�6�X�]�]�(�(�*�4�4�6�D�
�+�
1�
1�/�1�C���E�C��c�N�E��
�W�X�ab��g�g�l�l�7�D�)�G��g�g�l�l�7�N�3�G�')�w�w�~�~�g�'>�'>�4�9�9�T�'�]�#�D�D���������5�k��
�/��v�R��C��z��J�K� (���0��1�t�A�w���0�
�
�c�#�h�Z�'8���?�@��#�q�!���
��1�#�S��9���b��:��s�);�(<�E�!�H�+��O�P�"��u�u�u���K�K��$�'��E��#�q�!����u�u�Y���&�q�>�A�i�L��M�!��A�a�	�l�8�&<�%=�T�!�I�,�w�BW�AX�XZ�[�\��4�&��!��A�a��g�Y�d�3���'�'�,�,�t�W�-��
�7�7�>�>�'�"�"� �g�J���;�;�;�
�L�L��$�'��
	Y�)2�1�Y�<��3H�A�a�S�PQ�RS�TX�RY�QZ�J[�)\�&�G�T�3����'�*��T�M�E�
�H�H�7��s�[_�&.�&7�&7�&;�&;�&=�&H�&H�&J�&T�&T�^g�&T�&h�
�
j��K��s�%��S�z��g�Y�?�@�%"�0!$�$��1��w�w��G�$�
�
�
�
�
�
!�
,�
,�
.�
8�
8�)�
8�
L�C���j�#�|�d�j�j�b�5E�5E�l�TW�5X��%�,�g��y�%��
�E�B�E�b��R�R��X��0�1�E�B��5�#�e�*�e�S��X�}�c�Ik�UX�Ik�Fk�l��e�E�1�o�/@�!�-�-�/�
�G��F�
�C��I�I�g�t�C��~�a�0��J�J�s�G���Z�r�z�z�'�2�Z�dh�i�E��I�I�w����R�W�W�\�\�'�<�%H�#� N�O� �"&�*�*�W�5�"I�J�LQ�R�B���6�	�3��%�%�b�)��J�J�w����)�	�G�D�6��G�H�-�.�k�%��@T�UZ�[^�T_�_h�ip�rC�jD�EH�iI�J�K���!�-�0�C��H�<�����1�R�QR�R��k1��8�}�}�	S��K��s�.���4�5�q�|�|�G�T�7R�7R���	Y��K��s�)�C��F�4�L�>�:�;�Q�\�\�'�SW�=X�=X��	Y��%��Cs=�;Y4�B&Y9�\� \
"�9\�#Z8�8\�\�3\�\�__main__))z]\b(storm|flood|flooding|rain|hurricane|wildfire|fire|heat|snow|weather|climate|nor.?easter)\bzForecast: More of ThiszMOfficials remain confident the situation is under a light drizzle of control.z�a tiny official in a suit calmly holding a cocktail umbrella while a colossal wave curls over a row of houses behind him, a weather vane spinning off its roof)z;\b(court|judge|lawsuit|sues|trial|ruling|legal|antitrust)\bzJustice, EventuallyzFThe verdict is expected sometime after the heat death of the universe.z�a towering stack of legal paperwork reaching into the clouds, a very small judge climbing it with a rope and pickaxe, lawyers waving from base camp)z�\b(rates?|inflation|markets?|stocks?|economy|prices?|banks?|mortgage|tariffs?|jobs|business|pays?|salary|income|grosses|\$[0-9])zThe Market SpeakszMAnalysts describe the outlook as 'a rollercoaster, but with fewer seatbelts.'z|an ordinary family clinging to a runaway rollercoaster made of a price chart, a smiling banker selling tickets at the bottom)zk\b(election|senate|congress|vote|polls?|campaign|lawmakers|administration|policy|bill|rules|regulations?)\bzBusiness as Usualz;Both sides agree on one thing: it's the other side's fault.z�two identical politicians in a tug of war over a crumbling capitol dome, the rope fraying, a tiny citizen standing underneath holding a teacup)zP\b(war|strikes?|military|missiles?|troops|attack|ceasefire|deal|talks|nuclear)\bzPeace Talks, Round 47z.The negotiating table has been extended again.z|generals on both sides of an absurdly long negotiating table that stretches past the horizon, doves nesting in their helmets)zD\bai\b|robot|tech|app|chip|data center|software|phone|internet|cyberzProgress ReportzCThe machine assures everyone it has their best interests memorized.z�a giant friendly robot gently holding a tiny office worker like a pet, feeding him emails through a funnel, server racks humming behind)z>\b(health|virus|vaccines?|hospitals?|drugs?|disease|medical)\bzSecond Opinionz.Take two headlines and call me in the morning.zua doctor handing a patient an enormous pill the size of a boulder, a line of worried patients stretching out the door)zD\b(games?|team|season|league|coach|playoffs?|championship|sports?)\bzGame DayzBThe fans have announced they will now be coaching from the stands.zwa stadium where the crowd has climbed onto the field to play while the players watch from the bleachers eating hot dogs)M�__doc__r�rr2r6rErr*rg�sys�urllib.requestr�ri�dirname�abspath�__file__�HERErr	rk�insertrj�commonr[�APP�cap_usd�
expanduserrHrrLryr�r��TOP_Nr�rr�r�r�rrXrY�compiler,r�r�rrxr�r%r/r7rVrsrr�r�r�r�r�r�r�r�r�r�r�r�r�r	rr?r)rFrdr��__name__�exit)r�s0r�<module>r�s����0V�U�U�U�U�	�w�w���r�w�w���x�0�1��	�z�z�~�~�n�%�>�>�������)>��������2�7�7�<�<������� 5�7G�H�I�����H��	�	�w�w���"�*�*�.�.��:b�c�d���r�z�z�~�~�&:�D�A�B���r�z�z�~�~�&:�D�A�B��
�'�'�,�,�t�W�
%��
�'�'�,�,�t�4�
5��	���:�:�>�>�*>�@\�]�c�c�dg�h�n�h�a�lm���h�n���z�z�~�~�8�+�F���j�j�n�n�&�(?�@���J�J�N�N�2�4d�e�	��	�w��K�
�	���E�r�t�t�	L��	�z�z�_�`b�`d�`d�f��F��
�R�RW�RW�RY�[��
�/�
G�7�&5��"u�
?���<
V�U�@�I�
���P�	Q��	�
�
�A�CE�CG�CG�	H���
j�
�	�8"��u��#�*��L�
L�
S�"JS�Z�z���H�H�T�V����Aos�	M�-M