+
    Vim              	           R t ^ RIHtHtHtHt ^RIHtHtH	t	H
t
 ^RIHt ^RIHtHtHtHt RR R lltRR R	 lltRR
RRRRRRR/R R llltR R ltR R ltRR
RRRRRRR/R R llltR R ltR# )z.
Scraping functionality for Firecrawl v2 API.
)OptionalDictAnyLiteral)ScrapeOptionsDocumentBrowserExecuteResponseBrowserDeleteResponse)normalize_document_input)
HttpClienthandle_response_errorprepare_scrape_optionsvalidate_scrape_optionsNc                t    V ^8  d   QhR\         R\        \        ,          R\        \         \        3,          /# )   urloptionsreturn)strr   r   r   r   )formats   "Z/home/ubuntu/hermes-agent/venv/lib/python3.14/site-packages/firecrawl/v2/methods/scrape.py__annotate__r      s3       x/F RVWZ\_W_R`     c                    V '       d   V P                  4       '       g   \        R4      hRV P                  4       /pVe4   \        V4      pVe%   \        V4      pV'       d   VP	                  V4       V# )z
Prepare a scrape request payload for v2 API.

Args:
    url: URL to scrape
    options: ScrapeOptions (snake_case) to convert and include
    
Returns:
    Request payload dictionary with camelCase fields
zURL cannot be emptyr   )strip
ValueErrorr   r   update)r   r   request_data	validatedoptss   &&   r   _prepare_scrape_requestr       sd     ciikk.//$)399;#7L+G4	 ))4D##D)r   c                ^    V ^8  d   QhR\         R\        R\        \        ,          R\        /# )r   clientr   r   r   )r   r   r   r   r   )r   s   "r   r   r   )   s.     " ": "C "(=2I "U] "r   c                L   \        W4      pV P                  RV4      pVP                  '       g   \        VR4       VP	                  4       pVP                  R4      '       g   \        VP                  RR4      4      hVP                  R/ 4      p\        V4      p\        R/ VB # )a  
Scrape a single URL and return the document.

The v2 API returns: { success: boolean, data: Document }
We surface just the Document to callers.

Args:
    client: HTTP client instance
    url: URL to scrape
    options: Scraping options (snake_case)
    
Returns:
    Document
z
/v2/scrapescrapesuccesserrorUnknown error occurreddata )	r    postokr   jsonget	Exceptionr
   r   )r"   r   r   payloadresponsebodydocument_data
normalizeds   &&&     r   r$   r$   )   s     &c3G{{<1H;;;h1==?D88I*BCDDHHVR(M)-8J!j!!r   promptlanguagenodetimeoutoriginc                    V ^8  d   QhR\         R\        R\        \        ,          R\        \        ,          R\        R	,          R\        \        ,          R\        \        ,          R\
        /# 
r   r"   job_idcoder4   r5   r7   r8   r   )pythonr6   bashr   r   r   r   intr   )r   s   "r   r   r   H   sn     ?0 ?0?0?0 3-?0
 SM?0 ./?0 c]?0 SM?0 ?0r   c                  V'       d   VP                  4       '       g   \        R4      hT;'       d    VP                  4       pT;'       d    VP                  4       pV'       g   V'       g   \        R4      hRV/p	V'       d   W)R&   V'       d   W9R&   Ve   WYR&   Ve   WiR&   V P                  RV R	2V	4      p
V
P                  '       g   \	        V
R
4       V
P                  4       pVP                  R4      '       g   \        VP                  RR4      4      h\        V4      pRV9   d   RV9  d   VR,          VR&   RV9   d   RV9  d   VR,          VR&   RV9   d   RV9  d   VR,          VR&   \        R/ VB # )a  
Interact with the scrape-bound browser session for a scrape job.

Either ``code`` or ``prompt`` must be provided.  When ``prompt`` is given
the server runs an AI agent that translates the natural-language instruction
into browser actions.

Args:
    client: HTTP client instance
    job_id: Scrape job ID
    code: Code to execute (optional if prompt is provided)
    prompt: Natural-language instruction for the browser agent (optional if code is provided)
    language: Programming language ("python", "node", or "bash")
    timeout: Execution timeout in seconds (1-300)
    origin: Optional request origin tag

Returns:
    BrowserExecuteResponse with execution output
Job ID cannot be emptyz*Either 'code' or 'prompt' must be providedr5   r<   r4   r7   r8   /v2/scrape/	/interactzinteract with scrape browserr%   r&   r'   exitCode	exit_codeliveViewUrllive_view_urlinteractiveLiveViewUrlinteractive_live_view_urlr)   )
r   r   r*   r+   r   r,   r-   r.   dictr   )r"   r;   r<   r4   r5   r7   r8   has_code
has_promptr1   r0   r/   r3   s   &&&$$$$      r   interactrN   H   se   : 122$$

H**FLLNJJEFF 	HD VX!YX{{[	:DAH;;;h(FGmmoG;;y!!G-EFGGgJZKz$A",Z"8
;
"j'H&0&?
?#:-2MU_2_2<=U2V
./!/J//r   c                <    V ^8  d   QhR\         R\        R\        /# r   r"   r;   r   r   r   r	   )r   s   "r   r   r      s&     / /// /r   c                n   V'       d   VP                  4       '       g   \        R4      hV P                  RV R24      pVP                  '       g   \	        VR4       VP                  4       p\        V4      pRV9   d   RV9  d   VR,          VR&   RV9   d   RV9  d   VR,          VR&   \        R	/ VB # )
z
Stop the interaction session for a scrape job.

Args:
    client: HTTP client instance
    job_id: Scrape job ID

Returns:
    BrowserDeleteResponse
rB   rC   rD   zstop interactionsessionDurationMssession_duration_mscreditsBilledcredits_billedr)   )r   r   deleter+   r   r,   rK   r	   )r"   r;   r0   r/   r3   s   &&   r   stop_interactionrX      s     122}}{6()<=H;;;h(:;mmoGgJj(-B*-T,67J,K
()*$)9)K'1/'B
#$ .:..r   c                <    V ^8  d   QhR\         R\        R\        /# rP   rQ   )r   s   "r   r   r      &     , ,,, ,r   c                    \        W4      # z(Deprecated alias for stop_interaction().rX   r"   r;   s   &&r   stop_interactive_browserr_          
 F++r   c                    V ^8  d   QhR\         R\        R\        \        ,          R\        \        ,          R\        R	,          R\        \        ,          R\        \        ,          R\
        /# r:   r?   )r   s   "r   r   r      sn       3-
 SM ./ c] SM r   c          
     &    \        V VVVVVVR7      # )z Deprecated alias for interact().)r4   r5   r7   r8   )rN   )r"   r;   r<   r4   r5   r7   r8   s   &&&$$$$r   scrape_executerc      s&      r   c                <    V ^8  d   QhR\         R\        R\        /# rP   rQ   )r   s   "r   r   r      rZ   r   c                    \        W4      # r\   r]   r^   s   &&r   delete_scrape_browserrf      r`   r   )N)__doc__typingr   r   r   r   typesr   r   r   r	   utils.normalizer
   utilsr   r   r   r   r    r$   rN   rX   r_   rc   rf   r)   r   r   <module>rl      s    0 /  7 f f2">?0
 !?0 39?0 "?0 !?0 ?0D/>,
 ! 39 " ! ,,r   