
    i                     R    d Z ddlmZ ddlmZ ddlmZ ddddd	d
ZdgZdZd Z	d Z
y)zTootfinder (social media)    )datetime)loads)html_to_textzhttps://www.tootfinder.chzAhttps://wiki.tootfinder.ch/index.php?name=the-tootfinder-rest-apiTFJSON)websiteofficial_api_documentationuse_official_apirequire_api_keyresultszsocial mediac                 "    t          d|  |d<   |S )Nz/rest/api/search/url)base_url)queryparamss     )/root/searxng/searx/engines/tootfinder.pyrequestr      s    j 1%9F5MM    c                    g }d}| j                   j                  d      D ]  }|j                  d      s|} n t        |      D ]  }d }|j	                  dg       }|D cg c]  }|d   dk(  s|d    }}t        |      dkD  r|d   }|j	                  d	i       j	                  d
      }	|	st        |d         d d }	|j                  |d   |	t        |d         |t        j                  |d   d      d        |S c c}w )N 
z[{media_attachmentstypeimagepreview_urlr   cardtitlecontentK   r   
created_atz%Y-%m-%d %H:%M:%S)r   r   r   	thumbnailpublishedDate)
textsplit
startswithr   getlenr   appendr   strptime)
respr   json_strlineresultr    attachments
attachmentimagesr   s
             r   responser0      s%   G H		% ??4 H
 / 
	jj!4b9>Ik
ZX^M_cjMj*]+kkv;?q	I

62&**73 	!23CR8Ee}'y(9:&!)!2!26,3GI\!]	

, N% ls    C?.C?N)__doc__r   jsonr   searx.utilsr   about
categoriesr   r   r0    r   r   <module>r7      sB       $ +"e	 
&
!r   