PK ! ܚ> > ) __pycache__/__init__.cpython-36.opt-1.pycnu [ 3
(6]XY @ s d Z dZdZdZdZdgZddlZddlZddlZddl Z ddl
Z
dd lmZm
Z
dd
lmZ ddlmZmZmZmZmZmZmZmZmZmZmZ dd
k G dd deZeZeZG dd deZG dd de Z!G dd de"Z#e$dkr
ddlZeej%Z&e'e&j( dS )aH Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup uses a pluggable XML or HTML parser to parse a
(possibly invalid) document into a tree representation. Beautiful Soup
provides methods and Pythonic idioms that make it easy to navigate,
search, and modify the parse tree.
Beautiful Soup works with Python 2.7 and up. It works better if lxml
and/or html5lib is installed.
For more than you ever wanted to know about Beautiful Soup, see the
documentation:
http://www.crummy.com/software/BeautifulSoup/bs4/doc/
z*Leonard Richardson (leonardr@segfault.org)z4.6.3z*Copyright (c) 2004-2018 Leonard RichardsonZMIT
BeautifulSoup N )builder_registryParserRejectedMarkup)
UnicodeDammit)CDataCommentDEFAULT_OUTPUT_ENCODINGDeclarationDoctypeNavigableStringPageElementProcessingInstruction ResultSetSoupStrainerTagz`You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.zuYou need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).c s e Zd ZdZdZddgZdZdZd2d d
Zdd Z d
d Z
edd Zdd Z
dd Zddi fddZefddZdd Zdd Zdd Zdd Zefd!d"Zd3d#d$Zd4d&d'Zd(d) Zd5d*d+Zd,d- Zd.ed/f fd0d1 Z ZS )6r a
This class defines the basic interface called by the tree builders.
These methods will be called by the parser:
reset()
feed(markup)
The tree builder may call these methods from its feed() implementation:
handle_starttag(name, attrs) # See note about return value
handle_endtag(name)
handle_data(data) # Appends to the current data node
endData(containerClass=NavigableString) # Ends the current data node
No matter how complicated the underlying parser is, you should be
able to build a tree using 'start tag' events, 'end tag' events,
'data' events, and "done with data" events.
If you encounter an empty-element tag (aka a self-closing tag,
like HTML's
tag), call handle_starttag and then
handle_endtag.
z
[document]ZhtmlZfastz
a No parser was explicitly specified, so I'm using the best available %(markup_type)s parser for this system ("%(parser)s"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line %(line_number)s of the file %(filename)s. To get rid of this warning, pass the additional argument 'features="%(parser)s"' to the BeautifulSoup constructor.
Nc " s d krt jd d kr* d= t jd d krB d= t jd d krZ d= t jd d krr d = t jd
fdd}|p|d
d}|p|dd}|rt|trt jd d}t dkrt j j } td| |dkr|}
t|tr|g}|dkst|dkr| j }t
j| }|dkr@tddj
| | }|
|jkpZ|
|jks|jrld}nd}d}
ytjd}
W n tk
r Y nX |
r|
j}|
j}n
tj}d}|jd}|r|j }|jd(r|dd) }|rt|||j|d}t j| j| dd || _|j| _| j| _| | j_|| _t |d rN|j! }nt|d!krt|t"rrd"|kst|trd#|krt|trt#j$j% r|j&d$}n|}d%}yt#j$j'|}W n$ t(k
r } zW Y dd}~X nX |rt|tr|j&d$}t jd&| | j)| xZ| jj*|||d'D ]D\| _+| _,| _-| _.| j/ y| j0 P W n t1k
rr Y nX q2W d| _+d| j_dS )*a_ Constructor.
:param markup: A string or a file-like object representing
markup to be parsed.
:param features: Desirable features of the parser to be used. This
may be the name of a specific parser ("lxml", "lxml-xml",
"html.parser", or "html5lib") or it may be the type of markup
to be used ("html", "html5", "xml"). It's recommended that you
name a specific parser, so that Beautiful Soup gives you the
same results across platforms and virtual environments.
:param builder: A specific TreeBuilder to use instead of looking one
up based on `features`. You shouldn't need to use this.
:param parse_only: A SoupStrainer. Only parts of the document
matching the SoupStrainer will be considered. This is useful
when parsing part of a document that would otherwise be too
large to fit into memory.
:param from_encoding: A string indicating the encoding of the
document to be parsed. Pass this in if Beautiful Soup is
guessing wrongly about the document's encoding.
:param exclude_encodings: A list of strings indicating
encodings known to be wrong. Pass this in if you don't know
the document's encoding but you know Beautiful Soup's guess is
wrong.
:param kwargs: For backwards compatibility purposes, the
constructor accepts certain keyword arguments used in
Beautiful Soup 3. None of these arguments do anything in
Beautiful Soup 4 and there's no need to actually pass keyword
arguments into the constructor.
ZconvertEntitieszBS4 does not respect the convertEntities argument to the BeautifulSoup constructor. Entities are always converted to Unicode characters.Z
markupMassagezBS4 does not respect the markupMassage argument to the BeautifulSoup constructor. The tree builder is responsible for any necessary markup massage.Z
smartQuotesTozBS4 does not respect the smartQuotesTo argument to the BeautifulSoup constructor. Smart quotes are always converted to Unicode characters.ZselfClosingTagszBS4 does not respect the selfClosingTags argument to the BeautifulSoup constructor. The tree builder is responsible for understanding self-closing tags.ZisHTMLzBS4 does not respect the isHTML argument to the BeautifulSoup constructor. Suggest you use features='lxml' for HTML and features='lxml-xml' for XML.c s0 | kr,t jd| |f | } | = |S d S )NzLThe "%s" argument to the BeautifulSoup constructor has been renamed to "%s.")warningswarn)Zold_namenew_namevalue)kwargs /usr/lib/python3.6/__init__.pydeprecated_argument s z3BeautifulSoup.__init__..deprecated_argumentZparseOnlyThese
parse_onlyZfromEncoding
from_encodingzlYou provided Unicode markup but also provided a value for from_encoding. Your from_encoding will be ignored.Nr z2__init__() got an unexpected keyword argument '%s'zjCouldn't find a tree builder with the features you requested: %s. Do you need to install a parser library?,ZXMLZHTMLr __file__.pyc.pyo)filenameline_numberparsermarkup_type )
stacklevelread <<utf8Fzw"%s" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.)exclude_encodings)r r )2r r
isinstancestrlenlistkeyspop TypeErrorDEFAULT_BUILDER_FEATURESr lookupFeatureNotFoundjoinNAMEZALTERNATE_NAMESis_xmlsys _getframe
ValueError f_globalsf_lineno__dict__getlowerendswithdictNO_PARSER_SPECIFIED_WARNINGbuilderZ known_xmlsoupr hasattrr' bytesospathsupports_unicode_filenamesencodeexists Exception_check_markup_is_urlZprepare_markupmarkuporiginal_encodingZdeclared_html_encodingZcontains_replacement_charactersreset_feedr )selfrQ featuresrF r r r, r r argZoriginal_featuresZ
builder_classr$ Zcallerglobalsr" r! ZfnlvaluesZpossible_filenameis_fileer )r r __init__X s '
zBeautifulSoup.__init__c C s&