现在只是简单的查询一篇文章,但是可以给python小白用户(比如像我这样的)提供启发,直接上代码:
import urllib2 import re, random from bs4 import BeautifulSoup def GoogleScholarTitle(queryTitle): user_agents = ['Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0',\ 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0',\ 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533+',\ '(KHTML, like Gecko) Element Browser 5.0',\ 'IBM WebExplorer /v0.94', 'Galaxy/1.0 [en] (Mac OS X 10.5.6; U; en)', \ 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)', \ 'Opera/9.80