Google Scholar 服务器错误 HTML 解析器

Google Scholar Server Error HTML Parser

直到这周,我才能够使用一个简单的 html dom 解析器从 google 学者那里抓取内容。 (是的,我知道他们不希望人们这样做,因此没有 API)。

然而在过去一两天它停止显示内容。尝试简单的 file_get_html 或 url 时出现以下错误:

Server Error We're sorry but it appears that there has been an internal server error while processing your request. Our engineers have been notified and are working to resolve the issue.Please try again later.

我见过其他 ,但解决方案大多是特定于 R 或使用 cURL 的。有没有人建议调整我的简单 php 函数,尤其是调用两次?还是我运气不好,因为 Google 现在正在关闭这扇门?

我的代码:

<?php require_once('assets/functions/simple_html_dom.php');
$google_id = get_post_meta($post->ID, 'ecpt_google_id', true);
$google = new simple_html_dom;
$google_url = 'http://scholar.google.com/citations?user=' . $google_id . '&pagesize=10';
$older_pubs = 'http://scholar.google.com/citations?user=' . $google_id;
$google = file_get_html($google_url);

foreach($google->find('tr.gsc_a_tr') as $article) {
    $item['title']  = $article->find('td.gsc_a_t a', 0)->plaintext;
    $item['link']   = $article->find('a.gsc_a_at', 0)->href;
    $item['pub']    = $article->find('td.gsc_a_t .gs_gray', 1)->plaintext;
    $item['year']   = $article->find('td.gsc_a_y', 0)->plaintext;

    ?>
    <p class="pub"><b><a href="http://scholar.google.com<?php echo $item['link'];?>"><?php echo $item['title']; ?></a></b></p>
    <h6 class="pub"><?php echo $item['year']; ?>, <?php echo $item['pub']; ?></h6>


    <?php } ?>
<p align="right"><b><a href="<?php echo $older_pubs; ?>">View Publications</a></b></p>

Google 不再接受 cookie 就无法访问学者。 如果您尝试使用 curl/wget/...

进行访问,则会出现 "server error"

尝试接受 cookie,curl/php 请参阅:

然后加载页面两次(第一次接受 cookie 和服务器错误,第二次获取内容。)