Format: application/x-python-code
⬇ Download File (15.7 KB)
   1  o
   2  
   3  /'h�B�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N�)�_parse_date)�make_safe_absolute_uri)�FeedParserDictc@s�eZdZdZdddddddddddddd�
   4  Zdd�Zdd�Zdd	�Zd
   5  d�Zdd
   6  �Z	e	Z
   7  dd�Zdd�Zdd�Z
   8  e
   9  Zdd�ZeZdd�ZeZdd�ZeZdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�ZeZeZd,d-�Z e Z!e Z"d.d/�Z#d0d1�Z$d2d3�Z%e%Z&d4d5�Z'e'Z(d6d7�Z)e)Z*d8d9�Z+e+Z,d:d;�Z-e-Z.d<d=�Z/e/Z0d>d?�Z1d@dA�Z2dBdC�Z3dDdE�Z4dFdG�Z5e5Z6e5Z7dHdI�Z8e8Z9e8Z:dJdK�Z;e;Z<e;Z=dLdM�Z>e>Z?e>Z@dNdO�ZAdPdQ�ZBdRdS�ZCdTdU�ZDdVdW�ZEeEZFdXdY�ZGeGZHdZd[�ZId\d]�ZJd^d_�ZKd`da�ZLeLZMdbdc�ZNeNZOddde�ZPdfdg�ZQdhdi�ZRdjdk�ZSdldm�ZTeTZUdndo�ZVeVZWdpdq�ZXeXZYdrds�ZZdtdu�Z[dvdw�Z\dxdy�Z]dzd{�Z^d|d}�Z_d~d�Z`d�d��Zad�d��ZbebZcd�d��ZdedZed�d��ZfefZgefZhefZiefZjd�d��Zkd�d��Zld�S)��	Namespacez�Support for the Atom, RSS, RDF, and CDF feed formats.
  10  
  11      The feed formats all share common elements, some of which have conflicting
  12      interpretations. For simplicity, all of the base feed format support is
  13      collected here.
  14      �)
  15  rzhttp://backend.userland.com/rssz%http://blogs.law.harvard.edu/tech/rsszhttp://purl.org/rss/1.0/z&http://my.netscape.com/rdf/simple/0.9/zhttp://example.com/newformat#zhttp://example.com/nechozhttp://purl.org/echo/zuri/of/echo/namespace#zhttp://purl.org/pie/zhttp://purl.org/atom/ns#zhttp://www.w3.org/2005/Atomz'http://purl.org/rss/1.0/modules/rss091#cCsfddddd�}|jr|j�d�s1|�dd�}|�|�}|r"||_dS|�d	�r,d
  16  |_dSd|_dSdS)NZrss091uZrss092Zrss093Zrss094)z0.91z0.92z0.93z0.94Zrss�versionrz2.Zrss20)r�
  17  startswith�get��self�attrs_dZ
  18  versionmapZattr_versionr�r�QC:\Users\shubh\Videos\agent\nova\Lib\site-packages\feedparser/namespaces/_base.py�
  19  _start_rss<s�
  20  
  21  
  22  
  23  
  24  
  25  �zNamespace._start_rsscCsd|_|�|�dS)N�)�infeed�_cdf_common�rr
  26  rrr�_start_channelQszNamespace._start_channelcCs`d|vr|�i�|d|jdd<|��d|vr.|�i�|d|jdd<|��dSdS)NZlastmod������href)�_start_modifiedZelementstack�
  27  _end_modified�_start_link�	_end_linkrrrrrUs
  28  
  29  �zNamespace._cdf_commoncCsHd|_dddd�}|js"|�d�}|�|�}|r||_dSd|_dSdS)NrZatom01Zatom02Zatom03)z0.1z0.2z0.3rZatom)rrr
  30  rrrr�_start_feed_s�
  31  
  32  
  33  
  34  �zNamespace._start_feedcCs
  35  d|_dS)Nr)r�rrrr�_end_channells
  36  zNamespace._end_channelcCs8|��}|js|�dt��d|_d|_|�dd�dS)N�imagerrr)�_get_context�inentry�
  37  setdefaultr�inimage�title_depth�push�rr
  38  �contextrrr�_start_imagepszNamespace._start_imagecC�|�d�d|_dS)Nrr)�popr#rrrr�
  39  _end_imagex�
  40  
  41  zNamespace._end_imagecCs2|��}|�dt��d|_d|_|�dd�dS)N�	textinputrrr)r r"r�intextinputr$r%r&rrr�_start_textinput|s
  42  zNamespace._start_textinputcCr))Nr-r)r*r.rrrr�_end_textinput�r,zNamespace._end_textinputcCs:d|_|�dd�|��}|�dg�|d�t��dS)Nr�authorZauthors)�inauthorr%r r"�appendrr&rrr�
  43  _start_author�s
  44  zNamespace._start_authorcCs|�d�d|_|��dS)Nr1r)r*r2�_sync_author_detailrrrr�_end_author�s
  45  zNamespace._end_authorcCs:d|_|��}|�dg�|d�t��|�dd�dS)NrZcontributors�contributorr)�
  46  incontributorr r"r3rr%r&rrr�_start_contributor�s
  47  zNamespace._start_contributorcCr))Nr7r)r*r8rrrr�_end_contributor�r,zNamespace._end_contributorcC�|�dd�dS)N�namer�r%rrrr�_start_name��zNamespace._start_namecCsl|�d�}|jr|�d|d�dS|jr|�d|�dS|jr'|�d|�dS|jr4|��}||d<dSdS)Nr<�	publisher)r*�inpublisher�_save_authorr2r8�_save_contributorr.r �r�valuer'rrr�	_end_name�s
  48  �zNamespace._end_namecCr;�N�widthrr=rrrr�_start_width�r?zNamespace._start_widthcC�L|�d�}zt|�}Wntyd}Ynw|jr$|��}||d<dSdSrG�r*�int�
  49  ValueErrorr#r rDrrr�
  50  _end_width��
  51  ��zNamespace._end_widthcCr;�N�heightrr=rrrr�
  52  _start_height�r?zNamespace._start_heightcCrJrPrKrDrrr�_end_height�rOzNamespace._end_heightcCr;)Nrrr=rrrr�
  53  _start_url�r?zNamespace._start_urlcCs:|�d�}|jr|�d|�dS|jr|�d|�dSdS)Nr)r*r2rBr8rC�rrErrr�_end_url�s
  54  �zNamespace._end_urlcCr;)N�emailrr=rrrr�_start_email�r?zNamespace._start_emailcCsR|�d�}|jr|�d|d�dS|jr|�d|�dS|jr'|�d|�dSdS)NrWr@)r*rArBr2r8rCrUrrr�
  55  _end_email�s
  56  �zNamespace._end_emailcC�|�d|dd�dS)N�subtitle�
  57  text/plainr��push_contentrrrr�_start_subtitle��zNamespace._start_subtitlecC�|�d�dS)Nr[��pop_contentrrrr�
  58  _end_subtitle��zNamespace._end_subtitlecCrZ)N�rightsr\rr]rrrr�
  59  _start_rights�r`zNamespace._start_rightscCra)Nrfrbrrrr�_end_rights�rezNamespace._end_rightscCsZ|j�t��|�dd�d|_d|_d|_|�|d�}|r&|��}||d<|�	|�dS)N�itemrrrz	rdf:about�id)
  60  �entriesr3rr%r!�
  61  guidislinkr$Z_get_attributer r)rr
  62  rjr'rrr�_start_item�szNamespace._start_itemcCs|�d�d|_d|_dS)Nrir)r*r!�
  63  hasContentrrrr�	_end_items
  64  
  65  zNamespace._end_itemcCr;)N�languagerr=rrrr�_start_language	r?zNamespace._start_languagecCs|�d�|_dS)Nrp)r*�langrrrr�
  66  _end_languager?zNamespace._end_languagecCr;)Nr@rr=rrrr�_start_webmasterr?zNamespace._start_webmastercCs|�d�|�d�dS)Nr@)r*r5rrrr�_end_webmasters
  67  zNamespace._end_webmastercCr;)N�	publishedrr=rrrr�_start_publishedr?zNamespace._start_publishedcC�"|�d�}|jdt|�dd�dS)NrvZpublished_parsedT��	overwrite�r*�_saverrUrrr�_end_published�
  68  zNamespace._end_publishedcCr;)N�updatedrr=rrrr�_start_updated!r?zNamespace._start_updatedcCs&|�d�}t|�}|jd|dd�dS)NrZupdated_parsedTry)r*rr|)rrEZparsed_valuerrr�_end_updated&s
  69  zNamespace._end_updatedcCr;)N�createdrr=rrrr�_start_created-r?zNamespace._start_createdcCrx)Nr�Zcreated_parsedTryr{rUrrr�_end_created0r~zNamespace._end_createdcCr;)N�expiredrr=rrrr�_start_expirationdate4r?zNamespace._start_expirationdatecCs|jdt|�d��dd�dS)NZexpired_parsedr�Try)r|rr*rrrr�_end_expirationdate7szNamespace._end_expirationdatecCsD|�d�}|�d|�d��}|�d�}|�|||�|�dd�dS)N�term�scheme�domain�label�categoryr)r
  70  �_add_tagr%)rr
  71  r�r�r�rrr�_start_category:s
  72  
  73  
  74  zNamespace._start_categorycCs\|�d�}|s	dS|��}|d}|r%t|�r%|dds%||dd<dS|�|dd�dS)Nr��tagsrr�)r*r �lenr�)rrEr'r�rrr�
  75  _end_categoryBs
  76  zNamespace._end_categorycCst|�|��d<dS)N�cloud)rr rrrr�_start_cloudNr`zNamespace._start_cloudcCs�|�dd�|ddkr|�dd�n|�dd�|��}|�|�}d|vr/|�|d�|d<|jp7|jp7|j}|�dg�|jrD|jsM|d�t	|��d|vro|�
  77  d�dkrk|�|�
  78  d��|jvrm|d|d	<dSdSdS|�
  79  d	|�dS)
  80  N�rel�	alternater�typezapplication/atom+xml�	text/htmlr�links�link)r"r �
  81  _enforce_href�resolve_urirr!�insourcer#r3rr
  82  �map_content_type�
  83  html_typesr%)rr
  84  r'Zexpecting_textrrrrQs&
  85  �zNamespace._start_linkcCra)Nr�)r*rrrrrhrezNamespace._end_linkcCs"|�dd�dk|_|�dd�dS)NZispermalink�truerjr)r
  86  rlr%rrrr�_start_guidkszNamespace._start_guidcCs>|�d�}|�d|jod|��v�|jr|�d|�dSdS)Nrjrlr�)r*r|rlr rUrrr�	_end_guidps
  87  
  88  �zNamespace._end_guidcCs<|jr
  89  |�dt|����S|�d|d|jp|jp|j�dS)N�titler\)�svgOKZunknown_starttag�list�itemsr^rr!r�rrrr�_start_titleys"zNamespace._start_titlecCs(|jrdS|�d�}|sdS|j|_dS)Nr�)r�rc�depthr$rUrrr�
  90  _end_title~s
  91  zNamespace._end_titlecCsL|��}d|vr|jsd|_|�|�dS|�d|d|jp"|jp"|j�dS)N�summary�content�descriptionr�)r rn�_summaryKey�_start_contentr^rr!r�r&rrr�_start_description�s
  92  "zNamespace._start_descriptioncCs"|�d|d|jp
  93  |jp
  94  |j�dS)Nr�r\)r^rr!r�rrrr�_start_abstract�s"zNamespace._start_abstractcCs(|jdkr
  95  |��n|�d�d|_dS)Nr�r��r��_end_contentrcrrrr�_end_description�s
  96  
  97  
  98  
  99  zNamespace._end_descriptioncCrZ)N�infor\rr]rrrr�_start_info�r`zNamespace._start_infocCra)Nr�rbrrrr�	_end_info�rezNamespace._end_infocCsH|r|�|�}d|vr|�|d�|d<t|�|��d<|�dd�dS)Nr�generator_detail�	generatorr)r�r�rr r%rrrr�_start_generator�s
 100  zNamespace._start_generatorcCs.|�d�}|��}d|vr||dd<dSdS)Nr�r�r<)r*r rDrrr�_end_generator�s
 101  
 102  �zNamespace._end_generatorcCsF|��}d|vr|jsd|_|�|�dSd|_|�|j|dd�dS)Nr�r�r\r)r rnr�r�r^r&rrr�_start_summary�szNamespace._start_summarycCs.|jdkr
 103  |��n|�|jpd�d|_dS)Nr�r�r�rrrr�_end_summary�s
 104  
 105  
 106  zNamespace._end_summarycCs4|�|�}|��}d|d<|�dg��t|��dS)NZ	enclosurer�r�)r�r r"r3rr&rrr�_start_enclosure�s
 107  zNamespace._start_enclosurecCs2d|vr|d|jd<|�dd�d|_d|_dS)N�urlr�sourcerr)�
 108  sourcedatar%r�r$rrrr�
 109  _start_source�s
 110  
 111  zNamespace._start_sourcecCs@d|_|�d�}|r||jd<t�|j�|��d<|j��dS)Nrr�r�)r�r*r��copy�deepcopyr �clearrUrrr�_end_source�s
 112  
 113  zNamespace._end_sourcecCs>d|_|�d|dd�|�d�}|r||jd<|�dd�dS)Nrr�r\�src)rnr^r
 114  �
 115  contentparamsr%)rr
 116  r�rrrr��s
 117  
 118  zNamespace._start_contentcCrZ)Nr�zapplication/xhtml+xmlrr]rrrr�_start_body�r`zNamespace._start_bodycCsd|_|�d|dd�dS)Nrr�r�)rnr^rrrr�_start_content_encoded�sz Namespace._start_content_encodedcCs@|�|j�d��dh|jBv}|�d�}|r|�d|�dSdS)Nr�r\r�r�)r�r�r
 119  r�rcr|)rZ
 120  copyToSummaryrErrrr��s
 121  
 122  �zNamespace._end_contentcCr;)N�newlocationrr=rrrr�_start_newlocation�r?zNamespace._start_newlocationcCs8|�d�}|��}||jurdSt|j|���|d<dS)Nr�)r*r ZfeeddatarZbaseuri�strip)rr�r'rrr�_end_newlocation�s
 123  
 124  
 125  zNamespace._end_newlocationN)m�__name__�
 126  __module__�__qualname__�__doc__Zsupported_namespacesrrrrrZ	_end_feedr(r+r/Z_start_textInputr0Z_end_textInputr4Z_start_managingeditorr6Z_end_managingeditorr9r:r>rFrIrNrRrSrTZ_start_homepageZ
 127  _start_urirVZ
 128  _end_homepageZ_end_urirXrYr_Z_start_taglinerdZ_end_taglinergZ_start_copyrightrhZ_end_copyrightrmZ_start_entryroZ
 129  _end_entryrqrsrtrurwZ
 130  _start_issuedZ_start_pubdater}Z_end_issuedZ_end_pubdater�rZ_start_lastbuilddater�rZ_end_lastbuilddater�r�r�r�r�Z_start_keywordsr�Z
 131  _end_keywordsr�rrr�Z	_start_idr�Z_end_idr�r�r�r�r�Z
 132  _end_abstractr�Z!_start_feedburner_browserfriendlyr�Z_end_feedburner_browserfriendlyr�r�r�r�r�r�r�r�r�Z_start_xhtml_bodyr�Z_start_fullitemr�Z	_end_bodyZ_end_xhtml_bodyZ_end_content_encodedZ
 133  _end_fullitemr�r�rrrrr$s��
 134  
 135  
 136  
 137  	
 138  	r)	r�Z	datetimesr�urlsr�utilr�objectrrrrr�<module>s
 139