为啥抓到一堆HTML和JS代码?????????????????????????????????
程序:
from cookielib import * from urllib2 import * can=CookieJar() a=build_opener(HTTPCookieProcessor(can)) install_opener(a) returns=urlopen("https://book.douban.com/") i=returns.read() print i 结果: <div class="section ebook-area"></div> <div id="reviews" class="section" ></div></div> <div class="aside"> <!-- douban ad begin --> <div id="dale_book_home_top_right" class="s ad-placeholder" data-dstat-areaid="51" data-dstat-mode="click,expose" style="margin-top: 30px;"></div> <!-- douban ad end --> <!-- douban ad begin --> <div id="dale_book_home_top_right2" class="ad-placeholder"></div> <!-- douban ad end --> <h2 class=''> <span class="">鐑棬鏍囩</span> <span class="link-more"> <a class="" href="/tag/?view=type&icn=index-sorttags-all" >鎵€鏈夌儹闂ㄦ爣绛韭?/a> </span> </h2> <ul class="hot-tags-col5 s" data-dstat-areaid="54" data-dstat-mode="click,expose"> <li> <ul class="clearfix"> <li class="tag_title"> 鏂囧 </li> <li> <a href="/tag/灏忚" class="tag">灏忚</a> </li> <li> <a href="/tag/闅忕瑪" class="tag">闅忕瑪</a> </li> <li> <a href="/tag/鏃ユ湰鏂囧" class="tag">鏃ユ湰鏂囧</a>