Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 6]Ýtã@s dZdZddlZddlmZddlZddlZddlZdZyddl Z dd„Z WnFe k r’yddl Z dd„Z Wne k rŒdd„Z YnXYnXy ddl Z Wne k r´YnXejd jƒejƒZejd jƒejƒZGd d „d eƒZGd d„dƒZGdd„dƒZdS)aBBeautiful Soup bonus library: Unicode, Dammit This library converts a bytestream to Unicode through any means necessary. It is heavily based on code from Mark Pilgrim's Universal Feed Parser. It works best on XML and HTML, but it does not rewrite the XML or HTML to reflect a new encoding; that's the tree builder's job. ZMITéN)Úcodepoint2namecCstj|ƒdS)NÚencoding)ÚcchardetÚdetect)Ús©rú/usr/lib/python3.6/dammit.pyÚchardet_dammitsr cCstj|ƒdS)Nr)Úchardetr)rrrrr !scCsdS)Nr)rrrrr 'sz!^<\?.*encoding=['"](.*?)['"].*\?>z0<\s*meta[^>]+charset\s*=\s*["']?([^>]*?)[ /;'">]c@s”eZdZdZdd„Zeƒ\ZZZdddddd œZe j d ƒZ e j d ƒZ e d d „ƒZe dd„ƒZe dd„ƒZe ddd„ƒZe ddd„ƒZe dd„ƒZdS)ÚEntitySubstitutionzASubstitute XML or HTML entities for the corresponding characters.cCsni}i}g}xBttjƒƒD]2\}}t|ƒ}|dkrD|j|ƒ|||<|||<qWddj|ƒ}||tj|ƒfS)Né"z[%s]Ú)ÚlistrÚitemsÚchrÚappendÚjoinÚreÚcompile)ÚlookupZreverse_lookupZcharacters_for_reZ codepointÚnameÚ characterZ re_definitionrrrÚ_populate_class_variables9s  z,EntitySubstitution._populate_class_variablesZaposZquotZampÚltÚgt)ú'ú"ú&ú<ú>z&([<>]|&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;))z([<>&])cCs|jj|jdƒƒ}d|S)Nrz&%s;)ÚCHARACTER_TO_HTML_ENTITYÚgetÚgroup)ÚclsÚmatchobjÚentityrrrÚ_substitute_html_entityZsz*EntitySubstitution._substitute_html_entitycCs|j|jdƒ}d|S)zmUsed with a regular expression to substitute the appropriate XML entity for an XML special character.rz&%s;)ÚCHARACTER_TO_XML_ENTITYr")r#r$r%rrrÚ_substitute_xml_entity_sz)EntitySubstitution._substitute_xml_entitycCs6d}d|kr*d|kr&d}|jd|ƒ}nd}|||S)a*Make a value into a quoted XML attribute, possibly escaping it. Most strings will be quoted using double quotes. Bob's Bar -> "Bob's Bar" If a string contains double quotes, it will be quoted using single quotes. Welcome to "my bar" -> 'Welcome to "my bar"' If a string contains both single and double quotes, the double quotes will be escaped, and the string will be quoted using double quotes. Welcome to "Bob's Bar" -> "Welcome to "Bob's bar" rrz")Úreplace)ÚselfÚvalueZ quote_withZ replace_withrrrÚquoted_attribute_valuefsz)EntitySubstitution.quoted_attribute_valueFcCs"|jj|j|ƒ}|r|j|ƒ}|S)a Substitute XML entities for special XML characters. :param value: A string to be substituted. The less-than sign will become <, the greater-than sign will become >, and any ampersands will become &. If you want ampersands that appear to be part of an entity definition to be left alone, use substitute_xml_containing_entities() instead. :param make_quoted_attribute: If True, then the string will be quoted, as befits an attribute value. )ÚAMPERSAND_OR_BRACKETÚsubr(r,)r#r+Úmake_quoted_attributerrrÚsubstitute_xml‹s   z!EntitySubstitution.substitute_xmlcCs"|jj|j|ƒ}|r|j|ƒ}|S)aŸSubstitute XML entities for special XML characters. :param value: A string to be substituted. The less-than sign will become <, the greater-than sign will become >, and any ampersands that are not part of an entity defition will become &. :param make_quoted_attribute: If True, then the string will be quoted, as befits an attribute value. )ÚBARE_AMPERSAND_OR_BRACKETr.r(r,)r#r+r/rrrÚ"substitute_xml_containing_entities s   z5EntitySubstitution.substitute_xml_containing_entitiescCs|jj|j|ƒS)aìReplace certain Unicode characters with named HTML entities. This differs from data.encode(encoding, 'xmlcharrefreplace') in that the goal is to make the result more readable (to those with ASCII displays) rather than to recover from errors. There's absolutely nothing wrong with a UTF-8 string containg a LATIN SMALL LETTER E WITH ACUTE, but replacing that character with "é" will make it more readable to some people. )ÚCHARACTER_TO_HTML_ENTITY_REr.r&)r#rrrrÚsubstitute_html¶s z"EntitySubstitution.substitute_htmlN)F)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr ZHTML_ENTITY_TO_CHARACTERr3r'rrr1r-Ú classmethodr&r(r,r0r2r4rrrrr 5s$      %  r c@sHeZdZdZddd„Zdd„Zedd „ƒZed d „ƒZ edd d „ƒZ dS)ÚEncodingDetectora^Suggests a number of possible encodings for a bytestring. Order of precedence: 1. Encodings you specifically tell EncodingDetector to try first (the override_encodings argument to the constructor). 2. An encoding declared within the bytestring itself, either in an XML declaration (if the bytestring is to be interpreted as an XML document), or in a tag (if the bytestring is to be interpreted as an HTML document.) 3. An encoding detected through textual analysis by chardet, cchardet, or a similar external library. 4. UTF-8. 5. Windows-1252. NFcCsN|pg|_|pg}tdd„|Dƒƒ|_d|_||_d|_|j|ƒ\|_|_dS)NcSsg|] }|jƒ‘qSr)Úlower)Ú.0Úxrrrú Þsz-EncodingDetector.__init__..) Úoverride_encodingsÚsetÚexclude_encodingsÚchardet_encodingÚis_htmlÚdeclared_encodingÚstrip_byte_order_markÚmarkupÚsniffed_encoding)r*rFr?rCrArrrÚ__init__Ús zEncodingDetector.__init__cCs8|dk r4|jƒ}||jkrdS||kr4|j|ƒdSdS)NFT)r;rAÚadd)r*rÚtriedrrrÚ_usableæs  zEncodingDetector._usableccsÀtƒ}x |jD]}|j||ƒr|VqW|j|j|ƒr>|jV|jdkrZ|j|j|jƒ|_|j|j|ƒrp|jV|jdkr†t |jƒ|_|j|j|ƒrœ|jVxdD]}|j||ƒr¢|Vq¢WdS)z tag, hopefully near the beginning of the document. iigš™™™™™©?N)ÚendposrÚasciir)) rVÚmaxÚintÚxml_encoding_reÚsearchÚ html_meta_reÚgroupsÚdecoder;)r#rFrCZsearch_entire_documentZ xml_endposZ html_endposrDZdeclared_encoding_matchrrrrN+s   z'EncodingDetector.find_declared_encoding)NFN)FF) r5r6r7r8rHrKÚpropertyrPr9rErNrrrrr:Æs  ! r:c�@sReZdZdZdddœZdddgZgdd gfd d „Zd d „Z�ddd„Z�ddd„Z e dd„ƒZ dd„Z dd„Z �dd�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*d2�d+d2d2�d,�d-�d.�d/�d0�d1�d2�d3�d4�d5�d6�d7d2�d8�d9dQœ ZdRddSdTdUdVdWdXdYdZd[d\d]d2d^d2d2d_d_d`d`dadbdcdddedfdgdhd2didjddkdldmdndodpd[dqdPdrdsdkddtdbdudvdwdx�d:dzd{dadSd|drd}d~dd€d2d�d�d�d�d�d�d‚dƒd„d„d„d„d…d…d…d…d†d‡dˆdˆdˆdˆdˆdadˆd‰d‰d‰d‰djdŠd‹dŒdŒdŒdŒdŒdŒd�dldŽdŽdŽdŽd�d�d�d�dud�dududududud‘dudzdzdzdzd’dŠd’d“œ€Zd”d•d–d—d˜d™dšd›dœd�dždŸd d¡d¢d£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯d°d±d²d³d´dµd¶d·d¸d¹dºd»d¼d½d¾d¿dÀdÁdÂdÃdÄdÅdÆdÇdÈdÉdÊdËdÌdÍdÎdÏdÐdÑdÒdÓdÔdÕdÖd×dØdÙdÚdÛdÜdÝdÞdßdàdádâdãdädådædçdèdédêdëdìdídîdïdðdñdòdódôdõdöd÷dødùdúdûdüdýdþdÿ�d�d�d�d�d�d�d�d�d�d �d �d �d �d �dœzZ�d;�d<�d=gZe�d�dZe�d>�dZe�d?�d�d„ƒZdS(@Ú UnicodeDammitzÏA class for detecting the encoding of a *ML document and converting it to a Unicode string. If the source encoding is windows-1252, can replace MS smart quotes with their HTML or XML equivalents.z mac-romanz shift-jis)Ú macintoshzx-sjisú windows-1252z iso-8859-1z iso-8859-2NFcCsö||_g|_d|_||_tjtƒ|_t||||ƒ|_ t |t ƒsF|dkr`||_ t |ƒ|_ d|_dS|j j |_ d}x,|j jD] }|j j }|j|ƒ}|dk rxPqxW|sâx@|j jD]4}|dkrÂ|j|dƒ}|dk rª|jjdƒd|_PqªW||_ |sòd|_dS)NFr rYr)zSSome characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.T)Úsmart_quotes_toÚtried_encodingsZcontains_replacement_charactersrCÚloggingZ getLoggerr5Úlogr:ÚdetectorrTrUrFZunicode_markupÚoriginal_encodingrPÚ _convert_fromZwarning)r*rFr?rerCrAÚurrrrrHXs>     zUnicodeDammit.__init__cCs�|jdƒ}|jdkr&|jj|ƒjƒ}nf|jj|ƒ}t|ƒtkr„|jdkrfdjƒ|djƒdjƒ}qŒdjƒ|djƒdjƒ}n|jƒ}|S)z[Changes a MS smart quote character to an XML or HTML entity, or an ASCII character.érYZxmlz&#xú;rr)r"reÚMS_CHARS_TO_ASCIIr!ÚencodeÚMS_CHARSÚtypeÚtuple)r*ÚmatchZorigr.rrrÚ _sub_ms_charŠs     zUnicodeDammit._sub_ms_charÚstrictcCs®|j|ƒ}| s||f|jkr"dS|jj||fƒ|j}|jdk rh||jkrhd}tj|ƒ}|j|j |ƒ}y|j |||ƒ}||_||_ Wn t k r¦}zdSd}~XnX|jS)Ns([€-Ÿ])) Ú find_codecrfrrFreÚENCODINGS_WITH_SMART_QUOTESrrr.ruÚ _to_unicoderjÚ Exception)r*ZproposedÚerrorsrFZsmart_quotes_reZsmart_quotes_compiledrlrOrrrrk›s"     zUnicodeDammit._convert_fromcCs t|||ƒS)zGiven a string and its encoding, decodes the string into Unicode. %encoding is a string recognized by encodings.aliases)rU)r*rWrr{rrrry¶szUnicodeDammit._to_unicodecCs|js dS|jjS)N)rCrirD)r*rrrÚdeclared_html_encoding»sz$UnicodeDammit.declared_html_encodingcCs`|j|jj||ƒƒpN|r*|j|jddƒƒpN|r@|j|jddƒƒpN|rL|jƒpN|}|r\|jƒSdS)Nú-r Ú_)Ú_codecÚCHARSET_ALIASESr!r)r;)r*Úcharsetr+rrrrwÁs zUnicodeDammit.find_codecc Cs<|s|Sd}ytj|ƒ|}Wnttfk r6YnX|S)N)ÚcodecsrÚ LookupErrorÚ ValueError)r*r�ÚcodecrrrrÌs zUnicodeDammit._codecÚeuroÚ20ACú ÚsbquoÚ201AÚfnofÚ192ÚbdquoÚ201EÚhellipÚ2026ÚdaggerÚ2020ÚDaggerÚ2021ÚcircÚ2C6ÚpermilÚ2030ÚScaronÚ160ÚlsaquoÚ2039ÚOEligÚ152ú?ú#x17DÚ17DÚlsquoÚ2018ÚrsquoÚ2019ÚldquoÚ201CÚrdquoÚ201DÚbullÚ2022ÚndashÚ2013ÚmdashÚ2014ÚtildeÚ2DCÚtradeÚ2122ÚscaronÚ161ÚrsaquoÚ203AÚoeligÚ153ú#x17EÚ17EÚYumlr ) ó€ó�ó‚óƒó„ó…ó†ó‡óˆó‰óŠó‹óŒó�óŽó�ó�ó‘ó’ó“ó”ó•ó–ó—ó˜ó™óšó›óœó�óžóŸZEURú,Úfz,,z...ú+z++ú^ú%ÚSrZOEÚZrrÚ*r}z--ú~z(TM)rrZoeÚzÚYú!ÚcZGBPú$ZYENú|z..z(th)z<>z1/4z1/2z3/4ÚAZAEÚCÚEÚIÚDÚNÚOÚUÚbÚBÚaZaerOÚiÚnú/Úy)€r½r¾r¿rÀrÁrÂrÃrÄrÅrÆrÇrÈrÉrÊrËrÌrÍrÎrÏrÐrÑrÒrÓrÔrÕrÖr×rØrÙrÚrÛrÜó ó¡ó¢ó£ó¤ó¥ó¦ó§ó¨ó©óªó«ó¬ó­ó®ó¯ó°ó±ó²ó³ó´óµó¶ó·ó¸ó¹óºó»ó¼ó½ó¾ó¿óÀóÁóÂóÃóÄóÅóÆóÇóÈóÉóÊóËóÌóÍóÎóÏóÐóÑóÒóÓóÔóÕóÖó×óØóÙóÚóÛóÜóÝóÞóßóàóáóâóãóäóåóæóçóèóéóêóëóìóíóîóïóðóñóòóóóôóõóöó÷óøóùóúóûóüóýóþóÿs€s‚sÆ’s„s…s†s‡sˆs‰sÅ s‹sÅ’sŽs‘s’s“sâ€�s•s–s—sËœsâ„¢sÅ¡s›sÅ“sžsŸs s¡s¢s£s¤sÂ¥s¦s§s¨s©sªs«s¬s­s®s¯s°s±s²s³s´sµs¶s·s¸s¹sºs»s¼s½s¾s¿sÀsÃ�sÂsÃsÄsÃ…sÆsÇsÈsÉsÊsËsÃŒsÃ�sÃŽsÃ�sÃ�sÑsÃ’sÓsÔsÕsÖs×sØsÙsÚsÛsÜsÃ�sÞsßsàrsâsãsäsÃ¥sæsçsèsésêsësìsísîsïsðsñsòsósôsõsös÷søsùsúsûsüsýsþ)zé€é‚éƒé„é…é†é‡éˆé‰éŠé‹éŒéŽé‘é’é“é”é•é–é—é˜é™éšé›éœéžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿éÀéÁéÂéÃéÄéÅéÆéÇéÈéÉéÊéËéÌéÍéÎéÏéÐéÑéÒéÓéÔéÕéÖé×éØéÙéÚéÛéÜéÝéÞéßéàéáéâéãéäéåéæéçéèéééêéëéìéíéîéïéðéñéòéóéôéõéöé÷éøéùéúéûéüéýéþržr»rRr¼rËrSrÌrÐrQrrmÚutf8c Cs$|jddƒjƒdkrtdƒ‚|jƒdkr0tdƒ‚g}d }d }x¼|t|ƒk�rø||}t|tƒsft|ƒ}||jkr¬||jkr¬xz|j D]$\}} } ||kr‚|| kr‚|| 7}Pq‚Wq>|d krî||j krî|j |||…ƒ|j |j |ƒ|d 7}|}q>|d 7}q>W|d k�r|S|j ||d …ƒd j |ƒS)aÎFix characters from one encoding embedded in some other encoding. Currently the only situation supported is Windows-1252 (or its subset ISO-8859-1), embedded in UTF-8. The input must be a bytestring. If you've already converted the document to Unicode, you're too late. The output is a bytestring in which `embedded_encoding` characters have been converted to their `main_encoding` equivalents. r~r}ú windows-1252Ú windows_1252zPWindows-1252 and ISO-8859-1 are the only currently supported embedded encodings.rÛúutf-8z4UTF-8 is the only currently supported main encoding.rrarmNó)rÜrÝ)rÛrÞ) r)r;ÚNotImplementedErrorrVrTr[ÚordÚFIRST_MULTIBYTE_MARKERÚLAST_MULTIBYTE_MARKERÚMULTIBYTE_MARKERS_AND_SIZESÚWINDOWS_1252_TO_UTF8rr) r#Zin_bytesZ main_encodingZembedded_encodingZ byte_chunksZ chunk_startÚposZbyteÚstartÚendÚsizerrrÚ detwingle s<      zUnicodeDammit.detwingle)rv)rv)r†r‡)r‰rŠ)r‹rŒ)r�rŽ)r�r�)r‘r’)r“r”)r•r–)r—r˜)r™rš)r›rœ)r�rž)r r¡)r¢r£)r¤r¥)r¦r§)r¨r©)rªr«)r¬r­)r®r¯)r°r±)r²r³)r´rµ)r¶r·)r¸r¹)rºr»)r¼r )rrï)ržr»rR)r¼rËrS)rÌrÐrQéÿÿÿÿ)rÛrd)r5r6r7r8r€rxrHrurkryrar|rwrrqrorårärârãr9rêrrrrrbEs`1        rb)r8Z __license__r‚Z html.entitiesrrrgÚstringZ chardet_typerr Ú ImportErrorr Z iconv_codecrrprõr\r^Úobjectr r:rbrrrrÚs8