0
이 웹 페이지에는 "학습 위치 표시"탭이 있습니다.이 탭을 클릭하면 전체 위치 목록이 표시되고이 프로그램에 포함 된 웹 주소가 변경됩니다. 전체 위치 목록을 출력하는 프로그램을 실행하면 다음과 같은 결과가 나타납니다.Python : 숨겨진 HTML 표 내용 읽기
soup = BeautifulSoup(urllib2.urlopen('https://clinicaltrials.gov/ct2/show/study/NCT01718158?term=NCT01718158&rank=1&show_locs=Y#locn').read())
for row in soup('table')[5].findAll('tr'):
tds = row('td')
if len(tds)<2:
continue
print tds[0].string, tds[1].string #, '\n'.join(filter(unicode.strip, tds[1].strings))
Local Institution None
Local Institution None
Local Institution None
Local Institution None
Local Institution None
등등 ..... 나머지 정보는 제외합니다. 나는 여기서 뭔가를 놓치고 있다고 느낍니다. 내 결과는
United States, California
Va Long Beach Healthcare System
Long Beach, California, United States, 90822
United States, Georgia
Gastrointestinal Specialists Of Georgia Pc
Marietta, Georgia, United States, 30060
United States, New York
Weill Cornell Medical College
등이되어야합니다. 전체 위치 목록을 인쇄하고 싶습니다.
는 사용자 에이전트에 따라 변경 될 수 있습니다 생산 :
은 아마 당신은 모든 셀에서 데이터를 추출하고 여기 만
<td>
세포없이 행을 건너 뛸 필요 JavaScript로 채워질 수도 있습니다. 'wget --no-check-certificate https://clinicaltrials.gov/ct2/show/study/NCT01718158?term=NCT01718158&rank=1&s how_locs = Y'는 나에게 당신이 ' 다시 찾고. – Tom