小编gre*_*ker的帖子

Python/web scrape/aspx - 没有表格时人性化吗?

显然,总的菜鸟.为开放记录/政府透明度/报告/等利益教授用于网络抓取的自我Python.

我想要抓一个.aspx页面,2012年1月到3月是一个一周一周的日历

但它没有形式......

也许你很好,人们可以告诉我,在我花费数天时间与之抗争之前,解决方案是否可行.

http://webmail.legis.ga.gov/Calendar/default.aspx?chamber=house

查看日历上约会的唯一方法是在日历图片上选择一天.但是,至少,如果你点击星期一,它会显示所有一周的约会.(我想收集所有这些约会,以便计算每个委员会会议的频率,以及计算什么样的立法得到关注以及忽略哪种立法的代理.)

但是,使用什么策略?似乎每个月至少在其肠道内下降被指定为前缀为"V"的连续四位数字,如V4414,以及具有非前置数字的天数.

我只在2012年1月至3月期间狩猎; 其他月份是非密切关系,大部分是空的.

线索?

    ...<a href="javascript:__doPostBack('calMain','V4414')" style="color:#333333" title="Go to the previous month">February</a></td><td align="center" style="width:70%;">March 2012</td><td align="right" valign="bottom" style="color:#333333;font-size:8pt;font-weight:bold;width:15%;"><a href="javascript:__doPostBack('calMain','V4474')" style="color:#333333" title="Go to the next month">April</a></td></tr> 
Run Code Online (Sandbox Code Playgroud)

一种模式?

    ...<td align="center" style="color:#999999;width:14%;"><a      href="javascript:__doPostBack('calMain','4439')" style="color:#999999" title="February 26">26</a></td><td align="center" style="color:#999999;width:14%;"><a href="javascript:__doPostBack('calMain','4440')" style="color:#999999" title="February 27">27</a></td><td align="center" style="color:#999999;width:14%;"><a href="javascript:__doPostBack('calMain','4441')" style="color:#999999" title="February 28">28</a></td>...
Run Code Online (Sandbox Code Playgroud)

干杯谢谢!!

python asp.net scrape

5
推荐指数
2
解决办法
3211
查看次数

Python /解析:BeautifulSoup错误"模块obj不可调用",其结果来自Mechanize

更新:哇,你们所有人都是对的!
由于我还不明白的原因,我需要:"来自BeautifulSoup导入BeautifulSoup"并添加行:

response = br.submit()
print type(response) #new line
raw = br.response().read()#new line
print type(raw)#new line
print type(br.response().read())#new line
cooked = (br.response().read())#new line
soup = BeautifulSoup(cooked)
Run Code Online (Sandbox Code Playgroud)

/更新

嗯,BeautifulSoup和我没有认识到br.response().read()的结果.我已经进口了BeautifulSoup ......

#snippet:
# Select the first (index zero) form
br.select_form(nr=0)
br.form.set_all_readonly(False)
br['__EVENTTARGET'] = list_of_dates[0]
br['__EVENTARGUMENT'] = 'calMain'
br['__VIEWSTATE'] = viewstate
br['__EVENTVALIDATION'] = eventvalidation

response = br.submit()
print br.response().read() #*#this prints the html I'm expecting*

soup = BeautifulSoup(br.response().read()) #*#but this throws 
#TypeError: 'module' object is not callable.  
#Yet if I call soup = …
Run Code Online (Sandbox Code Playgroud)

python mechanize beautifulsoup

1
推荐指数
1
解决办法
2526
查看次数

d3.js简单区域图示例...得到"未定义"错误; 我想我需要一份退货声明?

我正在通过d3.js.org上的例子来学习d3.js

我从http://bl.ocks.org/3883195的 "区域图表"开始

我试着在自己打字,所以我会理解变量和功能.

该脚本调用data.tsv来生成图表.

好吧,当加载data.tsv时,我得到一个"'undefined'不是对象"错误.

所以我摆弄了一些,然后继续前进并复制并将bl.ock的原始代码粘贴到我的编辑器中,将他的d3.v3.js更改为d3.v2.js

同样的错误.

我觉得我的data.tsv在我的机器上的正确目录中,与d3.v2.js相同的目录.

第二行抛出错误:

    d3.tsv("data.tsv", function(error, data) { 
      data.forEach(function(d) { 
         d.date = parseDate(d.date);
         d.close = +d.close;
      });
Run Code Online (Sandbox Code Playgroud)

这是错误的图片:https: //twitter.com/maggie_a_lee/status/273858397173080064/photo/1

谢谢大家!!

undefined d3.js

1
推荐指数
1
解决办法
2866
查看次数

标签 统计

python ×2

asp.net ×1

beautifulsoup ×1

d3.js ×1

mechanize ×1

scrape ×1

undefined ×1