Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39428
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mailtomanage@163.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.109 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.79; '*S*': 0.01; 'output': 0.04; 'subject:same': 0.09; 'subject:not': 0.11; 'skip:f 30': 0.15; 'subject:expression': 0.16; 'urllib': 0.16; 'to:name:python- list@python.org': 0.20; 'import': 0.21; 'message-id:@163.com': 0.22; 'url:2012': 0.30; 'print': 0.32; 'received:220.181.13': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'subject:?': 0.35; 'why': 0.37; 'to:addr:python.org': 0.39; 'url:12': 0.40; 'skip:u 10': 0.60; 'url:p': 0.63; 'url:6': 0.65; 'url:v': 0.68; 'received:122': 0.70; 'url:163': 0.71; 'url:a': 0.72; 'url:4': 0.72; 'url:e': 0.78 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Received:Date:From:To:Subject:Content-Type: MIME-Version:Message-ID; bh=O+r+o3h1wkeElOZ/cr9Z38/pGAwC0DHVTiF6 LSH92fA=; b=CoBit94IfGnQfG3fr8b0OUtkpM5K3ZQVhytkJya8cx2KHejw2dqP tq/zj+N4fhWws2X4pcFqtTNKnZoK/gIYxAncJqO0lhbiroRVtShk8KK74XWPq01u n44+qgO/2OkF/4Tl8nIGvpApIOkv0HAor0NVscX9EFnuyNtMNi+1U4w= |
| X-Originating-IP | [122.198.132.130] |
| Date | Thu, 21 Feb 2013 22:09:19 +0800 (CST) |
| From | python <mailtomanage@163.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Subject | why can not parse the web in almost same xpath expression? |
| X-Priority | 3 |
| X-Mailer | Coremail Webmail Server Version SP_ntes V3.5 build 20130124(21453.5226.5222) Copyright (c) 2002-2013 www.mailtech.cn 163com |
| X-CM-CTRLDATA | qmajHGZvb3Rlcl9odG09MTYyOTo4MQ== |
| Content-Type | multipart/alternative; boundary="----=_Part_243809_890679402.1361455759942" |
| MIME-Version | 1.0 |
| X-CM-TRANSID | k8GowABnbgqQKiZRyGtfAA--.14234W |
| X-CM-SenderInfo | hpdlz3xrpd0tljh6il2tof0z/1tbisAnKPFEAAeQJuwABsI |
| X-Coremail-Antispam | 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2169.1361455778.2939.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361455778 news.xs4all.nl 6986 [2001:888:2000:d::a6]:52145 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39428 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
import urllib
import lxml.html
down='http://v.163.com/special/visualizingdata/'
file=urllib.urlopen(down).read()
root=lxml.html.document_fromstring(file)
urllist=root.xpath('//div[@class="down s-fc3 f-fl"]//a')
for url in urllist:
print url.get("href")
i get the output ,
http://mov.bn.netease.com/movieMP4/2012/12/A/7/S8H1TH9A7.mp4
http://mov.bn.netease.com/movieMP4/2012/12/D/9/S8H1ULCD9.mp4
http://mov.bn.netease.com/movieMP4/2012/12/4/P/S8H1UUH4P.mp4
http://mov.bn.netease.com/movieMP4/2012/12/B/V/S8H1V8RBV.mp4
http://mov.bn.netease.com/movieMP4/2012/12/6/E/S8H1VIF6E.mp4
http://mov.bn.netease.com/movieMP4/2012/12/B/G/S8H1VQ2BG.mp4
when i change
xpath('//div[@class="down s-fc3 f-fl"]//a')
into
xpath('//div[@class="col f-cb"]//div[@class="down s-fc3 f-fl"]//a')
that is to say ,
urllist=root.xpath('//div[@class="col f-cb"]//div[@class="down s-fc3 f-fl"]//a')
why i can't get nothing?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
why can not parse the web in almost same xpath expression? python <mailtomanage@163.com> - 2013-02-21 22:09 +0800 Re: why can not parse the web in almost same xpath expression? Piet van Oostrum <piet@vanoostrum.org> - 2013-03-06 22:13 -0400
csiph-web