1、页面解析和数据提取简介
(1)结构数据:先有的结构,再谈数据
-JSON文件
-JSON Path
-转换成python类型进行操作(json类)
-XML文件
-转换成python类型(xmltodict)
-XPath
-CSS选择器
-正则
(2)非结构化数据:先有数据,再谈结构
-文本、电话号码、邮箱地址
-通常处理此类数据,使用正则表达式
-Html文件
-正则
-XPath
-CSS选择器
2、正则表达式
(1)一套规则,可以在字符串文本中进行搜索替换等
在正则表达式中,可以对过滤到的字符串进行分组。分组使用圆括号的方式。
group
:和group(0)
是等价的,返回的是整个满足条件的字符串。groups
:返回的是里面的子组。索引从1开始。group(1)
:返回的是第一个子组,可以传入多个。
(2)-re的基本使用流程
'''
使用大致步骤:
1、compile函数将正则表达式的字符串变为一个pattern对象
2、通过pattern对象的一些方法对文本进行匹配,匹配结果是一个Match对象
3、用Match对象的方法对结果进行操纵
'''
import re
#\d表示以数字
#后面+号表示这个数字可以出现一次或者多次
s = r"\d+" #r表示后面是原生字符串,后面不需要转义
#返回pattern对象
pattern = re.compile(s)
#返回一个match对象,后面的位置参数含义是从哪个位置开始查找,找到哪个位置结束
#默认找到一个匹配就返回
m = pattern.match("one12two34three56",3,10)
print(type(m))
#默认匹配从头部开始,所以此次结果为None
print(m)
print(m.group())
print(m.start(0))
print(m.end(0))
print(m.span(0))
运行:
<class 're.Match'>
<re.Match object; span=(3, 5), match='12'>
12
3
5
(3, 5)
-match的基本使用
'''
正则结果的match的使用案例
'''
import re
#以下正则分成了两个组,以小括号为单位
s = r'([a-z]+) ([a-z]+) ([a-z]+)'
pattern = re.compile(s,re.I) #re.I表示忽略大小写
m = pattern.match("Hello World wide web")
#group(0) 表示返回匹配成功的整个子串
s = m.group(0)
print(s)
a = m.span(0) #返回匹配成功整个子串的跨度
print(a)
#group(1)表示返回的第一个分组匹配成功的子串
s = m.group(1)
print(s)
a = m.span(1) #返回匹配成功的第一个子串的跨度
print(a)
s = m.groups() #等价于m.group(1),m.group(2)....
print(s)
运行:
Hello World wide
(0, 16)
Hello
(0, 5)
('Hello', 'World', 'wide')
(3)正则常用方法
-match:从开始位置开始查找,一次匹配
-search:从任何位置查找,一次匹配
-findall:全部匹配,返回列表
-finditer:全部匹配,返回迭代器
-split:分隔字符串,返回列表
-sub :替换
'''
search
'''
import re
s = r'\d+' #至少且只有一个数字
pattern = re.compile(s) #编译
m = pattern.search("one12two34three56")
print(m.group())
#参数表明搜查的起始范围
m = pattern.search("one12two34three56",10,40)
print(m.group())
'''
findall
'''
import re
pattern = re.compile(r'\d+')
s = pattern.findall("i am 18 years old and 185 high")
print(s)
s = pattern.finditer("i am 18 years old and 185 high")
print(type(s))
for i in s:
print(i.group())
运行:
12
56
['18', '185']
<class 'callable_iterator'>
18
185
(4)匹配中文
-中文unicode范围主要是在[u4e00-u9fa5]
'''
中文unicode案例
'''
import re
hello = u'你好,世界'
pattern = re.compile(r'[\u4e00-\u9fa5]+')
m = pattern.findall(hello)
print(m)
运行:
['你好', '世界']
(5)贪婪与非贪婪模式
-贪婪模式:在整个表达式匹配成功的前提下,尽可能多的匹配
-非贪婪模式:xxxxxx,尽可能少的匹配
-python里面数量词默认是贪婪模式
-例如:
-查找文本abbbbccc
-re是ab*
-贪婪模式:abbbb
-非贪婪模式:a
3、xml 为了传输数据
-XML(ExtensibleMarkupLanguage)
-http://www.w3school.com.cn/xml/index.asp
-概念:父节点、子节点、先辈节点、兄弟节点、后代节点
<?xml version="1.0" encoding="utf-8" ?>>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Gidada De</author>
<year>2018</year>
<price>23</price>
</book>
<book category="sport">
<title lang="en">Running</title>
<author>Klaus Kuka</author>
<year>2010</year>
<price>43</price>
</book>
<book category="education">
<title lang="en">Python is Python</title>
<author>Food War</author>
<year>2008</year>
<price>83</price>
</book>
</bookstore>
4、XPath
(1)XPath(XML Path Language),是一门在XML文档中查找信息的语言
-官方文档:http://www.w3school.com.cn/xpath/index.asp
-XPath开发工具
-开元的XPath表达式工具:XMLQuire
-chrome插件:Xpath Helper
-Firefox插件:XPath CHecker
(2)常用路径表达式
-nodename:选取此节点的所有子节点
- / :从根节点开始选
- // :选取元素,而不考虑元素的具体位置
- . :当前节点
- @ :选取属性
(3)案例:
-bookstore:选取bookstore下的所有子节点
-/bookstore:选取根元素
-bookstore/book:选取bookstore的所有为book的子元素
- //book:选取book子元素
- //@lang:选取名称为lNG的所有属性
(4)谓语(Predicates)
-谓语用来查找某个特定的节点,被镶嵌在方括号中
-/bookstore/book[1]:选取第一个属于bookstore下叫book的元素
-/bookstore/book[last()]:选取最后一个属于bookstore下叫book的元素
-/bookstore/book[last()-1]:选取倒数第二个属于bookstore下叫book的元素
-/bookstore/book[position()<3]:选取属于bookstore下叫book的前两个元素
-bookstore/book[@lang]:选取属于bookstore下叫book的,含有属性lang元素
-bookstore/book[@lang="cn"]:选取属于bookstore下叫book的,含有属性lang的值是cn的元素
-/bookstore/book[@price<90]:选取属于bookstore下叫book的,含有属性price的,且值小于90的元素
-/bookstore/book[@price<90]/title:选取属于bookstore下叫book的,含有属性price的,且值小于90的元素的子元素title
(5)通配符
- ‘*’:任何元素节点
- @*:匹配任何属性节点
-node():匹配任何类型的节点
(6)选取多个路径
-//book/title | //book/author:选取book元素中的title和author元素
-//title | //price:选取文档中所有的title和price元素
5、etree
(1)lxml库
-python的HTML/XML的解析器
-官方文档:http://lxml.de/index.html
-功能:
-解析HTML,
'''
安装lxml
'''
from lxml import etree
'''
用lxml来解析HTML代码
'''
text = '''
<div>
<url>
<li class="item-0"><a href="0.html">first item</a></li>
<li class="item-1"><a href="1.html">first item</a></li>
<li class="item-2"><a href="2.html">first item</a></li>
<li class="item-3"><a href="3.html">first item</a></li>
<li class="item-4"><a href="4.html">first item</a></li>
<li class="item-5"><a href="5.html">first item</a></li>
</url>
</div>
'''
#利用etree.HTML把字符串解析成HTML文档
html = etree.HTML(text)
s = etree.tostring(html)
print(s)
运行:
b'<html><body><div>\n <url>\n <li class="item-0"><a href="0.html">first item</a></li>\n <li class="item-1"><a href="1.html">first item</a></li>\n <li class="item-2"><a href="2.html">first item</a></li>\n <li class="item-3"><a href="3.html">first item</a></li>\n <li class="item-4"><a href="4.html">first item</a></li>\n <li class="item-5"><a href="5.html">first item</a></li>\n </url>\n</div>\n</body></html>'
--文件读取
from lxml import etree
#只能读取xml格式内容,html报错
html = etree.parse("./v31.html")
rst = etree.tostring(html,pretty_print=True)
print(rst)
-etree和XPath的配合使用
from lxml import etree
#只能读取xml格式内容,html报错
html = etree.parse("./v31.html")
print(type(html))
rst = html.xpath('//book')
print(type(rst))
print(rst)
#xpath的意思是查找带有category属性值为sport的book元素
rst = html.xpath('//book[@category="sport"]')
print(type(rst))
print(rst)
#xpath的意思是查找带有category属性值为sport的book元素下的year元素
rst = html.xpath('//book[@category="sport"]/year')
rst = rst[0]
print(type(rst))
print(rst.tag)
print(rst.text)
运行:
<class 'lxml.etree._ElementTree'>
<class 'list'>
[<Element book at 0x18f218047c8>, <Element book at 0x18f218048c8>, <Element book at 0x18f21804908>]
<class 'list'>
[<Element book at 0x18f218048c8>]
<class 'lxml.etree._Element'>
year
2010
6、CSS选择器 BeautifulSoup4
-现在使用BeautifulSoup4
-http://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/
-几个常用提取信息工具的比较:
-正则:很快,不好用,不用安装
-beautifilsoup:慢,使用简单,安装简单
-lxml:比较快,使用简单,安装一般
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
#bs自动转码
content = soup.prettify()
print(content)
(1)四大对象
-Tag
-NavigableString
-BeautifulSoup
-Comment
-Tag
-对应Html中的标签
-可以通过soup.tag_name
-tag两个重要属性:name、attrs
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
#bs自动转码
content = soup.prettify()
#print(soup.head)
print('==' * 12)
print(soup.link)
print(soup.link.name)
print(soup.link.attrs['type'])
#可以修改,因为已经得到并放进了内存中
soup.link.attrs['type'] = 'hahaha'
print(soup.link)
print('==' * 12)
运行:
========================
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
link
image/x-icon
<link href="/favicon.ico" rel="shortcut icon" type="hahaha"/>
========================
-NavigableString 对应内容值
-BeautifulSoup
-表示的是一个文档的内容,大部分可以把他当作tag对象
-一般我们可以用soup来表示
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
#bs自动转码
content = soup.prettify()
print('==' * 12)
print(soup.link)
print(soup.link.name)
print(soup.link.attrs['type'])
#可以修改,因为已经得到并放进了内存中
soup.link.attrs['type'] = 'hahaha'
print(soup.link)
print('==' * 12)
#NavigableString
print(soup.title)
print(soup.title.name)
print(soup.title.attrs)
print(soup.title.string)
print("==" * 12)
print(soup.name)
print(soup.attrs)
运行:
========================
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
link
image/x-icon
<link href="/favicon.ico" rel="shortcut icon" type="hahaha"/>
========================
<title>百度一下,你就知道</title>
title
{}
百度一下,你就知道
========================
[document]
{}
[document]
-Comment
-特殊类型的NavigableString类
-对其输出,则内容不包括注释符号
(2)遍历文档对象
-contents:tag的子节点以列表的方式给出
-children:子节点以迭代器形式返回
-descendants:所子孙节点
-string
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
#bs自动转码
content = soup.prettify()
print('==' * 12)
print(soup.link)
print(soup.link.name)
print(soup.link.attrs['type'])
#可以修改,因为已经得到并放进了内存中
soup.link.attrs['type'] = 'hahaha'
print(soup.link)
print('==' * 12)
#NavigableString
print(soup.title)
print(soup.title.name)
print(soup.title.attrs)
print(soup.title.string)
print("==" * 12)
print(soup.name)
print(soup.attrs)
运行:
========================
<meta content="text/html;charset=utf-8" http-equiv="content-type"/>
<meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
<meta content="always" name="referrer"/>
<meta content="#2932e1" name="theme-color"/>
百度一下,你就知道
========================
(3)搜索文档对象
-find_all(name,attrs,recursive,text,**kwargs)
-name:按照那个字符串搜索,可以传入的内容为
-字符串、正则表达式、列表
-keyworld参数,可以用来表示属性
-text:对应tag的文本值
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
#print(soup.name)
print("==" * 12)
#tags = soup.find_all(name="meta")
#正则
import re
tags = soup.find_all(re.compile("^me"),content="always")
for tag in tags:
print(tag)
print("==" * 12)
运行:
========================
<meta content="always" name="referrer"/>
========================
(4)css选择器
-使用soup.select,返回一个列表
-通过标签名称:soup.select("title")
-通过类名:soup.select(".content")
-id查找:soup.select("#name_id")
-组合查找:soup.select("div #input_content")
-属性查找:soup.select("img[class='photo']")
-获取tag内容:tag.get_text
from urllib import request
from bs4 import BeautifulSoup
url = 'http://www.baidu.com'
rsp = request.urlopen(url)
content = rsp.read()
soup = BeautifulSoup(content,'lxml')
print(soup.prettify())
print("==" * 12)
titles = soup.select("title")
print(titles[0])
print("==" * 12)
metas = soup.select("meta[content='always']")
print(metas[0])
print("==" * 12)
运行:
<!DOCTYPE html>
<!--STATUS OK-->
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="content-type"/>
<meta content="IE=Edge" http-equiv="X-UA-Compatible"/>
<meta content="always" name="referrer"/>
<meta content="#2932e1" name="theme-color"/>
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="/content-search.xml" rel="search" title="百度搜索" type="application/opensearchdescription+xml"/>
<link href="//www.baidu.com/img/baidu_85beaf5496f291521eb75ba38eacbd87.svg" mask="" rel="icon" sizes="any"/>
<link href="//s1.bdstatic.com" rel="dns-prefetch"/>
<link href="//t1.baidu.com" rel="dns-prefetch"/>
<link href="//t2.baidu.com" rel="dns-prefetch"/>
<link href="//t3.baidu.com" rel="dns-prefetch"/>
<link href="//t10.baidu.com" rel="dns-prefetch"/>
<link href="//t11.baidu.com" rel="dns-prefetch"/>
<link href="//t12.baidu.com" rel="dns-prefetch"/>
<link href="//b1.bdstatic.com" rel="dns-prefetch"/>
<title>
百度一下,你就知道
</title>
<style id="css_index" index="index" type="text/css">
html,body{height:100%}
html{overflow-y:auto}
body{font:12px arial;text-align:;background:#fff}
body,p,form,ul,li{margin:0;padding:0;list-style:none}
body,form,#fm{position:relative}
td{text-align:left}
img{border:0}
a{color:#00c}
a:active{color:#f60}
input{border:0;padding:0}
#wrapper{position:relative;_position:;min-height:100%}
#head{padding-bottom:100px;text-align:center;*z-index:1}
#ftCon{height:50px;position:absolute;bottom:47px;text-align:left;width:100%;margin:0 auto;z-index:0;overflow:hidden}
.ftCon-Wrapper{overflow:hidden;margin:0 auto;text-align:center;*width:640px}
.qrcodeCon{text-align:center;position:absolute;bottom:140px;height:60px;width:100%}
#qrcode{display:inline-block;*float:left;*margin-top:4px}
#qrcode .qrcode-item{float:left}
#qrcode .qrcode-item-2{margin-left:33px}
#qrcode .qrcode-img{width:60px;height:60px}
#qrcode .qrcode-item-1 .qrcode-img{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/qrcode/zbios_efde696.png) 0 0 no-repeat}
#qrcode .qrcode-item-2 .qrcode-img{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/qrcode/nuomi_365eabd.png) 0 0 no-repeat}
@media only screen and (-webkit-min-device-pixel-ratio:2){#qrcode .qrcode-item-1 .qrcode-img{background-image:url(http://s1.bdstatic.com/r/www/cache/static/home/img/qrcode/zbios_x2_9d645d9.png);background-size:60px 60px}
#qrcode .qrcode-item-2 .qrcode-img{background-image:url(http://s1.bdstatic.com/r/www/cache/static/home/img/qrcode/nuomi_x2_55dc5b7.png);background-size:60px 60px}}
#qrcode .qrcode-text{color:#999;line-height:23px;margin:3px 0 0}
#qrcode .qrcode-text a{color:#999;text-decoration:none}
#qrcode .qrcode-text p{text-align:center}
#qrcode .qrcode-text b{color:#666;font-weight:700}
#qrcode .qrcode-text span{letter-spacing:1px}
#ftConw{display:inline-block;text-align:left;margin-left:33px;line-height:22px;position:relative;top:-2px;*float:right;*margin-left:0;*position:static}
#ftConw,#ftConw a{color:#999}
#ftConw{text-align:center;margin-left:0}
.bg{background-image:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_5859e57.png);background-repeat:no-repeat;_background-image:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_d5b04cc.gif)}
.c-icon{display:inline-block;width:14px;height:14px;vertical-align:text-bottom;font-style:normal;overflow:hidden;background:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_5859e57.png) no-repeat 0 0;_background-image:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_d5b04cc.gif)}
.c-icon-triangle-down-blue{background-position:-480px -168px}
.c-icon-chevron-unfold2{background-position:-504px -168px}
#m{width:720px;margin:0 auto}
#nv a,#nv b,.btn,#lk{font-size:14px}
#nv{height:19px;font-size:16px;margin:0 0 4px;text-align:left;text-indent:137px}
.s_btn{width:95px;height:32px;padding-top:2px\9;font-size:14px;background-color:#ddd;background-position:0 -48px;cursor:pointer}
.s_btn_h{background-position:-240px -48px}
.s_btn_wr{width:97px;height:34px;display:inline-block;background-position:-120px -48px;*position:relative;z-index:0;vertical-align:top}
#jgwab{margin-left:19px}
#cp .c-icon-icrlogo,.c-icon-jgwablogo{width:14px;height:17px;display:inline-block;overflow:hidden;background:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_5859e57.png) no-repeat;_background-image:url(http://s1.bdstatic.com/r/www/cache/static/global/img/icons_d5b04cc.gif)}
#cp .c-icon-icrlogo{background-position:-600px -96px;position:relative;top:3px}
.c-icon-jgwablogo{background-position:-623px -96px;position:relative;top:3px}
#shouji{margin-right:14px}
#u{display:none}
#c-tips-container{display:none}
#wrapper{min-width:810px;height:100%;min-height:600px}
#head{position:relative;padding-bottom:0;height:100%;min-height:600px}
#head .head_wrapper{height:100%}
#m{position:relative}
#fm{padding-left:40px;top:-37px}
#lh a{margin-left:62px}
#lh #seth,#lh #setf{margin-left:0}
#lk{position:absolute;display:none;top:0;right:0;margin:33px 0}
#lk span{font:14px "宋体"}
#nv{position:absolute;display:none;top:0;right:0}
#lm{color:#666;width:100%;height:60px;margin-top:60px;line-height:15px;font-size:13px;position:absolute;top:0;left:0}
#lm a{color:#666}
#pad-version{line-height:40px}
.s_ipt_wr.bg,.s_btn_wr.bg,#su.bg{background-image:none}
.s_btn_wr{width:auto;height:auto;border-bottom:1px solid transparent;*border-bottom:0}
.s_btn{width:100px;height:36px;color:#fff;font-size:15px;letter-spacing:1px;background:#3385ff;border-bottom:1px solid #2d78f4;outline:medium;*border-bottom:0;-webkit-appearance:none;-webkit-border-radius:0}
.s_btn.btnhover{background:#317ef3;border-bottom:1px solid #2868c8;*border-bottom:0;box-shadow:1px 1px 1px #ccc}
.s_btn_h{background:#3075dc;box-shadow:inset 1px 1px 5px #2964bb;-webkit-box-shadow:inset 1px 1px 5px #2964bb;-moz-box-shadow:inset 1px 1px 5px #2964bb;-o-box-shadow:inset 1px 1px 5px #2964bb}
#result_logo{display:none}
#index_logo img{display:inline-block;width:270px;height:129px}
#s_tab{display:none}
.s_form{position:relative;top:38.2%}
.s_form_wrapper{position:relative;top:-191px}
.s_ipt_wr{height:34px}
#head .c-icon-bear-round{display:none}
#form{margin:22px auto 0;width:641px;text-align:left;z-index:100}
#form .bdsug,#fm .bdsug{top:35px}
.bdsug{display:none;position:absolute;width:538px;background:#fff;border:1px solid #ccc;_overflow:hidden;box-shadow:1px 1px 3px #ededed;-webkit-box-shadow:1px 1px 3px #ededed;-moz-box-shadow:1px 1px 3px #ededed;-o-box-shadow:1px 1px 3px #ededed}
.bdsug.bdsugbg ul{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/sugbg_1762fe7.png) 100% 100% no-repeat;background-size:100px 110px;background-image:url(http://s1.bdstatic.com/r/www/cache/static/home/img/sugbg_90fc9cf.gif)\9}
.bdsug li{width:522px;color:#000;font:14px arial;line-height:25px;padding:0 8px;position:relative;cursor:default}
.bdsug li.bdsug-s{background:#f0f0f0}
.bdsug-store span,.bdsug-store b{color:#7A77C8}
.bdsug-store-del{font-size:12px;color:#666;text-decoration:underline;position:absolute;right:8px;top:0;cursor:pointer;display:none}
.bdsug-s .bdsug-store-del{display:inline-block}
.bdsug-ala{display:inline-block;border-bottom:1px solid #e6e6e6}
.bdsug-ala h3{line-height:14px;background:url(//www.baidu.com/img/sug_bd.png) no-repeat left center;margin:8px 0 5px;font-size:12px;font-weight:400;color:#7B7B7B;padding-left:20px}
.bdsug-ala p{font-size:14px;font-weight:700;padding-left:20px}
.bdsug .bdsug-direct{width:auto;padding:0;border-bottom:1px solid #f1f1f1}
.bdsug .bdsug-direct p{color:#00c;font-weight:700;line-height:34px;padding:0 8px;cursor:pointer;white-space:nowrap;overflow:hidden}
.bdsug .bdsug-direct p img{width:16px;height:16px;margin:7px 6px 9px 0;vertical-align:middle}
.bdsug .bdsug-direct p span{margin-left:8px}
.bdsug .bdsug-direct p i{font-size:12px;line-height:100%;font-style:normal;font-weight:400;color:#fff;background-color:#2b99ff;display:inline;text-align:center;padding:1px 5px;*padding:2px 5px 0;margin-left:8px;overflow:hidden}
.bdsug .bdsug-pcDirect{color:#000;font-size:14px;line-height:30px;height:30px;background-color:#f8f8f8}
.bdsug .bdsug-pc-direct-tip{position:absolute;right:15px;top:8px;width:55px;height:15px;display:block;background:url(http://s1.bdstatic.com/r/www/cache/static/global/img/pc_direct_42d6311.png) no-repeat 0 0}
.bdsug li.bdsug-pcDirect-s{background-color:#f0f0f0}
.bdsug .bdsug-pcDirect-is{color:#000;font-size:14px;line-height:22px;background-color:#f8f8f8}
.bdsug .bdsug-pc-direct-tip-is{position:absolute;right:15px;top:3px;width:55px;height:15px;display:block;background:url(http://s1.bdstatic.com/r/www/cache/static/global/img/pc_direct_42d6311.png) no-repeat 0 0}
.bdsug li.bdsug-pcDirect-is-s{background-color:#f0f0f0}
.bdsug .bdsug-pcDirect-s .bdsug-pc-direct-tip,.bdsug .bdsug-pcDirect-is-s .bdsug-pc-direct-tip-is{background-position:0 -15px}
.bdsug .bdsug-newicon{color:#929292;opacity:.7;font-size:12px;display:inline-block;line-height:22px;letter-spacing:2px}
.bdsug .bdsug-s .bdsug-newicon{opacity:1}
.bdsug .bdsug-newicon i{letter-spacing:0;font-style:normal}
.bdsug .bdsug-feedback-wrap{text-align:right;background:#fafafa;color:#666;height:25px;line-height:25px;display:none}
.bdsug .bdsug-feedback{margin-right:10px;text-decoration:underline;color:#666}
.toggle-underline{text-decoration:none}
.toggle-underline:hover{text-decoration:underline}
.tools{position:absolute;right:-75px}
#mHolder{width:62px;position:relative;z-index:296;display:none}
#mCon{height:18px;line-height:18px;position:absolute;cursor:pointer}
#mCon span{color:#00c;display:block;width:24px}
#mCon .hw{text-decoration:underline;cursor:pointer;display:inline-block}
#mCon .pinyin{display:inline-block}
#mCon .c-icon-chevron-unfold2{margin-left:5px}
#mMenu a{width:100%;height:100%;display:block;line-height:22px;text-indent:6px;text-decoration:none;filter:none\9}
#mMenu,#user ul{box-shadow:1px 1px 2px #ccc;-moz-box-shadow:1px 1px 2px #ccc;-webkit-box-shadow:1px 1px 2px #ccc;filter:progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color=#cccccc)\9}
#mMenu{width:56px;border:1px solid #9b9b9b;list-style:none;position:absolute;right:27px;top:28px;display:none;background:#fff}
#mMenu a:hover{background:#ebebeb}
#mMenu .ln{height:1px;background:#ebebeb;overflow:hidden;font-size:1px;line-height:1px;margin-top:-1px}
#u1 a:link,#u1 a:visited{color:#666;text-decoration:none}
#u1 a:hover,#u1 a:active{text-decoration:underline}
#u1 a:active{color:#00c}
#u1{z-index:2;color:#fff;position:absolute;right:0;top:0;margin:19px 0 5px;padding:0 96px 0 0}
#u1 .reg{display:none}
#u1 a.pf,#u1 a.pf:visited{display:inline-block;float:left;color:#333;line-height:24px;font-size:13px;margin-left:20px;overflow:hidden;text-decoration:underline}
#u1 a.lb,#u1 a.lb:visited,#u1 a.username{display:inline-block;float:left;color:#333;font-size:13px;line-height:24px;margin-left:20px;text-decoration:underline}
#u1 a.bri,#u1 a.bri:visited{display:inline-block;position:absolute;right:10px;width:60px;height:23px;float:left;color:#fff;background:#38f;line-height:24px;font-size:13px;text-align:center;overflow:hidden;border-bottom:1px solid #38f;margin-left:19px;margin-right:2px}
#u1 a.bri.brihover{display:none;text-decoration:none;color:#333;background:0 0;border-bottom:1px solid transparent;margin-left:19px}
#u1 #lm a{color:#00c;text-decoration:underline}
#u1 a.mnav,#u1 a.mnav:visited{float:left;color:#333;font-weight:700;line-height:24px;margin-left:20px;font-size:13px;text-decoration:underline}
#u1 a.pf:hover,#u1 a.lb:hover,#u1 a.mnav:hover{color:#00c}
.briiconsbg{background-repeat:no-repeat;background-size:300px 18px;background-image:url(http://s1.bdstatic.com/r/www/cache/static/home/img/icons_0c37e9b.png);background-image:url(http://s1.bdstatic.com/r/www/cache/static/home/img/icons_809ae65.gif)\9}
.bdpfmenu{background-color:#fff;border:1px solid #d1d1d1;position:absolute;right:160px;width:68px;top:36px;margin-top:-1px;_margin-top:-3px;z-index:2;box-shadow:1px 1px 5px #d1d1d1;-webkit-box-shadow:1px 1px 5px #d1d1d1;-moz-box-shadow:1px 1px 5px #d1d1d1;-o-box-shadow:1px 1px 5px #d1d1d1}
.bdpfmenu a{display:block;text-align:left;margin:0!important;padding:0 9px;line-height:26px;text-decoration:none}
#wrapper .bdpfmenu a:link,#wrapper .bdpfmenu a:visited{background:#fff;color:#333}
#wrapper .bdpfmenu a:hover,#wrapper .bdpfmenu a:active{background:#38f;text-decoration:none;color:#fff}
#wrapper .bdnuarrow{width:0;height:0;font-size:0;line-height:0;display:block;position:absolute;top:-10px;left:50%;margin-left:-5px}
#wrapper .bdnuarrow em,#wrapper .bdnuarrow i{width:0;height:0;font-size:0;line-height:0;display:block;position:absolute;border:5px solid transparent;border-style:dashed dashed solid}
#wrapper .bdnuarrow em{border-bottom-color:#d8d8d8;top:-1px}
#wrapper .bdnuarrow i{border-bottom-color:#fff;top:0}
.s-isindex-wrap #wrapper .bdnuarrow{height:13px;background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/icons_0c37e9b.png) no-repeat -90px -1px}
#wrapper .bdnuarrow.bdbriarrow{right:104px;display:none!important}
#wrapper .bdbri{width:85px;min-height:100px;border-left:1px solid #e7e7e7;position:absolute;background-color:#f9f9f9;overflow:hidden;z-index:2;right:0;top:0}
#prefpanel{background:#fafafa;display:none;opacity:0;position:fixed;_position:absolute;top:-359px;z-index:1000;width:100%;min-width:960px;border-bottom:1px solid #ebebeb}
#prefpanel form{_width:850px}
#wrapper .bdbriimgtitle{color:#333;text-align:center;width:66px;height:43px;line-height:43px;padding-top:9px;margin:0 auto;border-bottom:#f0f0f0 1px solid;font-size:13px;cursor:default}
#wrapper .briscrollwrapper{overflow:hidden}
#wrapper .briscrollwrapperContainer{position:relative}
#wrapper .bdbri.bdbriimg .bdmainlink a,#wrapper .bdbri.bdbriimg .bdothlink a{display:block;text-align:center;width:66px;height:76px;margin:0 auto;border-bottom:#f0f0f0 1px solid;color:#666;text-decoration:none;overflow:hidden}
#wrapper .bdbri.bdbriimg .bdmainlink a:visited,#wrapper .bdbri.bdbriimg .bdothlink a:visited{color:#666}
#wrapper .bdbri.bdbriimg .bdmainlink a:hover,#wrapper .bdbri.bdbriimg .bdothlink a:hover{color:#666;text-decoration:underline}
#wrapper .bdbri.bdbriimg .bdmainlink a:active,#wrapper .bdbri.bdbriimg .bdothlink a:active{color:#00c;text-decoration:underline}
#wrapper .bdbri.bdbriimg span{width:36px;height:36px;display:block;margin:10px auto 5px;background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/bdbri_icons_194ae06.png) no-repeat;cursor:pointer}
#wrapper .bdbri.bdbriimg .bdbrimore,#wrapper .bdbri.bdbriimg .bdbrievenmore{clear:both;text-align:center}
#wrapper .bdbri.bdbriimg .bdbrievenmore{margin-top:15px;height:30px;width:85px;overflow:hidden}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_1{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/nuomi_7f5cd35.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_2{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/zhidao_cbf2aff.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_3{width:36px;background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/qqjt_9809ca8.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_4{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/image_55b5909.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_5{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/wenku_aaf198d.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_6{background:url(http://s1.bdstatic.com/r/www/cache/static/home/img/logos/fengyunbang_1986a40.png) no-repeat;background-size:cover}
#wrapper .bdbri.bdbriimg span.bdbriimgitem_7{background-position:-220px 0}
#wrapper .bdbri.bdbriimg .bdbrievenmore a:link,#wrapper .bdbri.bdbriimg .bdbrievenmore a:visited{color:#666;text-decoration:underline}
#wrapper .bdbri.bdbriimg .bdbrievenmore a:hover{color:#666;text-decoration:underline}
#wrapper .bdbri.bdbriimg .bdbrievenmore a:active{color:#00c}
.bdbriscroll-ctrl-scroll{position:absolute;top:10px;right:1px;width:8px;border-top:1px solid #e4e4e4;border-left:1px solid #e4e4e4;cursor:default;-webkit-user-select:none;-moz-user-select:none}
.bdbriscroll-ctrl-scroll .bdbriscroll-axis{width:8px;left:0;z-index:0;position:absolute;background:#f2f2f2}
.bdbriscroll-ctrl-scroll-touch .bdbriscroll-axis{width:7px;background:#f2f2f2}
.bdbriscroll-ctrl-scroll-hover .bdbriscroll-axis{background:#f2f2f2}
.bdbriscroll-ctrl-scroll .bdbriscroll-slider{overflow:hidden;width:7px;height:14px;position:absolute;left:0;z-index:10;display:none;background:#d9d9d9;margin-top:-1px;margin-left:-1px;border-right:1px solid #cecece;border-bottom:1px solid #cecece;cursor:default}
.bdbriscroll-ctrl-scroll-touch .bdbriscroll-slider,.bdbriscroll-ctrl-scroll-hover .bdbriscroll-slider{background:#b8b8b8;border-right:1px solid #afafaf;border-bottom:1px solid #afafaf}
.s_ipt::-webkit-input-placeholder{padding-left:3px;color:#aaa;font-size:13px}
.s_ipt::-moz-placeholder{padding-left:3px;color:#aaa;font-size:13px}
.s_ipt:-ms-i