擅长:python、mysql、java
<p>您可以使用ghost.py直接与页面上的JavaScript交互,而不是尝试对其进行反向工程。</p>
<p>如果在chrome控制台中运行以下查询,您将看到它返回您想要的所有内容。</p>
<pre><code>document.getElementsByClassName('inline-text-org');
</code></pre>
<p>回报</p>
<pre><code>[<div class="inline-text-org" title="University of Manchester">University of Manchester</div>,
<div class="inline-text-org" title="University of California Irvine">University of California ...</div>
etc...
</code></pre>
<p>您可以使用<a href="https://github.com/jeanphix/Ghost.py" rel="nofollow noreferrer">ghost.py</a>在现实生活中的DOM中通过python运行JavaScript。</p>
<p>这真的很酷:</p>
<pre><code>from ghost import Ghost
ghost = Ghost()
page, resources = ghost.open('http://academic.research.microsoft.com/Search?query=lander')
result, resources = ghost.evaluate(
"document.getElementsByClassName('inline-text-org');")
</code></pre>