
    im                         d dl mZ d dlmZ d dlZd dlZ eddg          Z ej        e          Z	e
                    d          defd	            ZdS )
    )	APIRouter)JSONResponseNz/xembedxembed)prefixtags urlc                 F  K   	 d|  d}t          j        d          4 d{V }|                    |           d{V }|j        dk    r%t	          ddid	
          cddd          d{V  S |                                }t	          d|                    dd          i          cddd          d{V  S # 1 d{V swxY w Y   dS # t          $ rG}t                              d|            t	          dt          |          id
          cY d}~S d}~ww xY w)z0Proxy X/Twitter oEmbed API to avoid CORS issues.z'https://publish.twitter.com/oembed?url=z&omit_script=true&maxwidth=560g      $@)timeoutN   errorzCould not fetch embedi  )status_codehtmlr   zxembed error: i  )
httpxAsyncClientgetr   r   json	Exceptionloggerr   str)r	   
oembed_urlclientrespdataes         )/wd/v2025.freedom4um.com/routes/xembed.py
get_xembedr   
   sF     
@bsbbb
$T222 	@ 	@ 	@ 	@ 	@ 	@ 	@fJ////////D3&&#W.E$FTWXXX	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 99;;D&")=)= >??	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@  @ @ @)a))***Wc!ff-3?????????@sL   !C 9B<C 18B<)C <
CC 	C
C 
D <DD D )fastapir   fastapi.responsesr   r   loggingrouter	getLogger__name__r   r   r   r        r   <module>r&      s          * * * * * *  	)8*	5	5	5		8	$	$ B@# @ @ @ @ @ @r%   