
    !}gG
                         d Z dZdZdZdZddlZddlmZ dd	lm	Z	 dd
l
mZmZ ddlmZ ddlmZmZ ddefdZddefdZd Zd Zd ZddZdS )z
Ignore the unused imports, this file's purpose is to make visible
anything which a user might need to import from newspaper.
View newspaper/__init__.py for its usage.
	newspaperzLucas Ou-YangMITzCopyright 2014, Lucas Ou-Yang    N   )ArticleConfiguration)POPULAR_URLSTRENDING_URL)Source)extend_configprint_available_languages Freturnc                     |pt                      }t          ||          }| pd} t          | |          }|s|                                 |S )zXReturns a constructed source object without
    downloading or parsing the articles
    r   config)r   r   r   build)urldryr   kwargsss        M/var/www/py-google-trends/myenv/lib/python3.11/site-packages/newspaper/api.pyr   r      sV     &}F66**F
)Cs6"""A 				H    c                 p    |pt                      }t          ||          }| pd} t          | |          }|S )zLReturns a constructed article object without downloading
    or parsing
    r   r   )r   r   r   )r   r   r   as       r   build_articler   "   sA     &}F66**F
)CF###AHr   c                  "    t                       dS )z.Returns a list of the supported languages
    N)r    r   r   	languagesr   -   s     r   c                      t          t                    5 } d |                                 D             }|cddd           S # 1 swxY w Y   dS )z8Returns a list of pre-extracted popular source urls
    c                 <    g | ]}d |                                 z   S )zhttp://)strip).0us     r   
<listcomp>z popular_urls.<locals>.<listcomp>7   s%    ===!	AGGII%===r   N)openr	   	readlines)furlss     r   popular_urlsr*   3   s     
l		 q==q{{}}===                 s    AA	Ac                      	 t          j        t                    d         } d | D             }|S # t          $ r(}t	          dt          |                     Y d}~dS d}~ww xY w)z2Returns a list of hit terms via google trends
    entriesc                     g | ]
}|d          S )titler   )r#   items     r   r%   zhot.<locals>.<listcomp>@   s    444D$w-444r   zERR hot terms failed!N)
feedparserparser
   	Exceptionprintstr)listingtrendses      r   hotr8   ;   sw    "<00;44G444   %s1vv...ttttts   ,/ 
A!AA!enc                    ddl m} ddlm} ddlm} ddlm}  |            }||_         ||          } ||          } ||          }	|	                                
                    |           }
|                    |
          }
|                    |
          }|                    |          }|	                    |          \  }}|S )zuTakes article HTML string input and outputs the fulltext
    Input string is decoded via UnicodeDammit if needed
    r   )DocumentCleanerr   )ContentExtractor)OutputFormatter)cleanersr;   configurationr   
extractorsr<   outputformattersr=   language
get_parser
fromstringcleancalculate_best_nodepost_cleanupget_formatted)htmlrB   r;   r   r<   r=   r   	extractordocument_cleaneroutput_formatterdoctop_nodetextarticle_htmls                 r   fulltextrQ   G   s    *))))),,,,,,,,,,,,111111]__FFO  ((I&v..&v..





(
(
.
.C

 
 
%
%C,,S11H%%h//H)77AAD,Kr   )r   FN)r   N)r9   )__doc__	__title__
__author____license____copyright__r0   articler   r?   r   settingsr	   r
   sourcer   utilsr   r   r   r   r   r*   r8   rQ   r   r   r   <module>r[      s"   
 	
/           ( ( ( ( ( ( 0 0 0 0 0 0 0 0       ; ; ; ; ; ; ; ;
 
v 
 
 
 
 G           	 	 	     r   