
    i9                     V    S r SSKJrJr  SSKJr   " S S\5      rS r " S S	\5      rg
)z%Extractors for https://www.4chan.org/   )	ExtractorMessage   )textc                   @    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
 rS rSrg)_4chanThreadExtractor   zExtractor for 4chan threads4chanthread)z
{category}z{board}z{thread} {title}z{tim} {filename}.{extension}z{board}_{thread}_{tim}z=(?:https?://)?boards\.4chan(?:nel)?\.org/([^/]+)/thread/(\d+)z+https://boards.4channel.org/a/thread/12345/c                 j    [         R                  " X5        UR                  5       u  U l        U l        g )N)r   __init__groupsboardr   selfmatchs     G/app/mltbenv/lib/python3.13/site-packages/gallery_dl/extractor/4chan.pyr   _4chanThreadExtractor.__init__   s$    4'"',,.
DK    c              #   Z  #    SU R                    SU R                   S3nU R                  U5      S   nUS   R                  S5      =(       d    [        R
                  " US   S   5      nU R                   U R                  [        R                  " U5      S S S	.n[        R                  S
U4v   U Hs  nSU;   d  M  UR                  U5        US   SS  US'   [        R                  " US   5      US'   [        US'   SUS    SUS    US    3n[        R                  X4v   Mu     g 7f)Nhttps://a.4cdn.org//thread/z.jsonposts    subcom2   )r   r   title filenameextr   	extension_http_signaturezhttps://i.4cdn.org/r   /tim)r   r   request_jsongetr   remove_htmlunescaper   	Directoryupdate_detect_null_byteUrl)r   urlr   r   dataposts         r   items_4chanThreadExtractor.items   s+    #DJJ<x}EJ!!#&w/aU#Ht'7'7a'H jjkkmmE*3B/
 T))DT!D!$(KO[!#'==j1A#BZ *;&'=/4;-U}Fkk3,, s   B8D+>A-D+)r   r   N)__name__
__module____qualname____firstlineno____doc__categorysubcategorydirectory_fmtfilename_fmtarchive_fmtpatternexampler   r1   __static_attributes__ r   r   r   r      s4    %HKAM1L*K(G;G1-r   r   c                 L    U (       a  U S   (       a  gU  H  nU(       d  M    g   g)z1Return False if all file signature bytes are nullr   Tz File data consists of null bytesr@   )	signaturebytes     r   r,   r,   5   s&    Q<Dt  .r   c                   4    \ rS rSrSrSrSrSrSrS r	S r
S	rg
)_4chanBoardExtractor@   zExtractor for 4chan boardsr
   r   z7(?:https?://)?boards\.4chan(?:nel)?\.org/([^/?#]+)/\d*$zhttps://boards.4channel.org/a/c                 D    [         R                  " X5        US   U l        g )Nr   )r   r   r   r   s     r   r   _4chanBoardExtractor.__init__G   s    4'1X
r   c              #      #    SU R                    S3nU R                  U5      nU HJ  nUS    H>  nSU R                    SUS    S3nUS   US'   [        US	'   [        R                  X4v   M@     ML     g 7f)
Nr   z/threads.jsonthreadszhttps://boards.4chan.org/r   nor$   page
_extractor)r   r&   r   r   Queue)r   r.   rJ   rL   r   s        r   r1   _4chanBoardExtractor.itemsK   s     #DJJ<}=##C(Dy/::,hvd|nA?!%fv'<|$mmS00 * s   A3A5)r   N)r3   r4   r5   r6   r7   r8   r9   r=   r>   r   r1   r?   r@   r   r   rE   rE   @   s#    $HKHG.G
1r   rE   N)	r7   commonr   r   r   r   r   r,   rE   r@   r   r   <module>rQ      s.    , & #-I #-L.19 1r   