給出一串字符串,我想從每個字符串的網站(例如sciencedirect.com)中查找搜索結果的數量。現有的答案Number of Google Results from Excel適用於Google。來自Excel的搜索結果數量
不幸的是這種解決方案創建一個從字符串即谷歌搜索例如搜索URL中包含單詞例子。我想使用的網站不這樣做。
任何想法,我怎麼achived相同的結果與這種類型的搜索引擎。
給出一串字符串,我想從每個字符串的網站(例如sciencedirect.com)中查找搜索結果的數量。現有的答案Number of Google Results from Excel適用於Google。來自Excel的搜索結果數量
不幸的是這種解決方案創建一個從字符串即谷歌搜索例如搜索URL中包含單詞例子。我想使用的網站不這樣做。
任何想法,我怎麼achived相同的結果與這種類型的搜索引擎。
當您點擊搜索按鈕時,您必須檢查您提交的表單。表單發送一個包含搜索條件的GET請求,但隨後您將被重定向到結果列表頁面,並且結果頁面的URL不再包含搜索條件。
我已經成功地搜索「文集」這個URL:
http://www.sciencedirect.com/science?_ob=QuickSearchURL&_method=submitForm&_acct=C000228598&_origin=home&_zone=qSearch&md5=61ce8901b141d527683913a240486ac4&qs_all=corpus
需要注意的是你必須做的就是
qs_all
領域除了qs_all
在這個網址的所有其他領域來自於形式爲隱藏領域。 這是相應形式的來源,因爲我下載了它(發送「文集」的搜索請求之前。):
<form name="qkSrch" method="get" target="_top" action="/science" style="margin:0px;">
<input type="hidden" name="_ob" value="QuickSearchURL">
<input type="hidden" name="_method" value="submitForm">
<input type="hidden" name="_acct" value="C000228598">
<input type="hidden" name="_origin" value="home">
<input type="hidden" name="_zone" value="qSearch">
<input type="hidden" name="md5" value="61ce8901b141d527683913a240486ac4">
<table border="0" width="100%" cellpadding="0" cellspacing="0" style="margin: 0;">
<tbody><tr valign="middle">
<!-- Code related for toggling labels -->
<td align="right"><label for="qs_all" id="fieldLabel"> All fields</label></td>
<td align="left"><input class="textbox qsinput xpstyle" type="text" name="qs_all" id="qs_all" value="" size="30" maxlength="450" title="For example: heart attack AND behavior?" tabindex="1"></td>
<td align="right"><label for="qs_author"> Author</label></td>
<td align="left" colspan="5"><input class="textbox qsinput xpstyle" type="text" name="qs_author" id="qs_author" value="" size="33" maxlength="450" title="e.g. J S Smith or John Smith or Smith JS" tabindex="2" style="_width:100%"></td>
<td nowrap="nowrap">
</td><td></td><td></td>
<td align="right" nowrap="nowrap" width="90%" valign="middle">
<a href="/science?_ob=MiamiSearchURL&_method=requestForm&_btn=Y&_acct=C000228598&_version=1&_urlVersion=1&_userid=10&md5=18a1082f74248d90d465ee65804fd7db" style="vertical-align:bottom;font-size:0.92em;">Advanced search</a>
</td>
</tr>
<tr>
<td align="right"><label for="qs_title"> Journal/Book title</label></td>
<td align="left"><input class="textbox qsinput xpstyle" type="text" id="qs_title" name="qs_title" value="" size="30" maxlength="450" title="For example: journal of molecular biology" tabindex="3"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_vol" id="volField"> Volume</label></td>
<td align="left" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_vol" id="qs_vol" value="" size="3" maxlength="10" style="width:30px;" tabindex="4"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_issue" id="issueField"> Issue</label></td>
<td align="left" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_issue" id="qs_issue" value="" size="3" maxlength="10" style="width:30px" tabindex="5"></td>
<td align="right" class="toggleQukSrch2"><label for="qs_pages" id="pageField"> Page</label></td>
<td align="right" class="toggleQukSrch"><input class="textbox qsinput xpstyle" type="text" name="qs_pages" id="qs_pages" value="" size="3" maxlength="10" title="For example: 14-27" style="width:30px" tabindex="6"></td>
<td align="right" nowrap="nowrap">
<input class="button" id="submit_search" type="Submit" alt="Submit Quick Search" title="Submit Quick Search" value="Search ScienceDirect" tabindex="8" name="sdSearch">
</td>
<td align="right" nowrap="nowrap" colspan="8" valign="bottom">
<a class="icon_qmarkHelpsci_dir" href="/science?_ob=HelpURL&_file=qs_tips.htm&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=2bd779305b31602341744eaa786e2f0a" target="sdhelp" onmouseover="window.status='Help is Available';return true" onmouseout="window.status='';return true" onclick="var helpWin;helpWin=window.open('/science?_ob=HelpURL&_file=qs_tips.htm&_acct=C000228598&_version=1&_urlVersion=0&_userid=10&md5=2bd779305b31602341744eaa786e2f0a','sdhelp','scrollbars=yes,resizable=yes,directories=no,toolbar=no,menubar=no,status=no,width=760,height=570');helpWin.focus();return false" tabindex="9" style="font-size:0.92em;padding-right:0;">Search tips</a>
</td>
</tr>
</tbody></table>
</form>
編輯 與如何從搜索結果頁中提取的結果數量持續。
你的假設是正確的,你將不得不改變代碼的其他部分,即提取結果數值。
讓我們繼續前面的例子。 當從「文集」搜索,你會發現在結果頁面的源代碼這一行:
<input type="hidden" name="TOTAL_PAGES" value="2836">
而且你要提取2836因此,你將尋找類似<input type="hidden" name="TOTAL_PAGES" value="
並獲得subequent值在結束報價之前。
我不會告訴你如何在VBA中編寫代碼,但它是基本的字符串操作,所以我希望你能處理它。
難道你不能從API獲取這些信息而不是抓取? HTTP:// WWW。developer.sciverse.com/ – JimmyPena