페이지에서 데이터를 추출하기 위해 urllib2로 페이지를 읽으려고합니다. 페이지의 일부는로드 당 생성되며 urllib2로 url을 읽을 때이 부분은 html에 없습니다.python urllib2 - 모든 스크립트가 실행 된 후 페이지 읽기
URL은 http://nametrends.net/name.php?name=Ruby이고 그래프 용으로 생성 된 테이블을 얻으려고합니다. 예를 들어 :
import urllib2
from bs4 import BeautifulSoup
req = urllib2.Request('http://nametrends.net/name.php?name=Ruby')
response = urllib2.urlopen(req)
the_page = response.read()
html = BeautifulSoup(the_page)
print "tabular" in html
for table in html.find_all('table'):
print 1
는 해당 테이블을 찾을 수없는, 그리고 사업부의 레이블 텍스트 표와 HTML에는 사업부가 (이 없습니다 :
<div aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;">
<table>
<tbody>
<tr><td>Sat Feb 01 1947 00:00:00 GMT-0500 (EST)</td><td>0.048</td><td>0</td></tr>
</tbody>
</table>
</div>
내 현재 코드입니다 테이블을 포함)
우리가 꽤 같은 질문에 답하고있는 것처럼 보입니다.) – Anzel
@Anzel 그래, 우리 스케줄을 조정할 필요가있어. :) – alecxe
이것은 오버 헤드가 적어 보이지만 데이터가 이상한 형식으로 제공됩니다 :) – Quantico