How do I do a Google scholar batch search, and get only the number of results back?

StackOverflow https://stackoverflow.com/questions/3719144

  •  03-10-2019
  •  | 
  •  

문제

I have a large list of things I want to search for in scholar.google.com (a list of chromosomal regions), and I only want to the number of results for each search term. Does anyone know what the best way is to do this?

도움이 되었습니까?

해결책

You can use this ruby script

#!/usr/bin/ruby

require 'net/http'
require 'uri'
def number_of_results(search_query)
    url = 'http://scholar.google.com/scholar'
    query = '?hl=en&btnG=Search&as_sdt=2001&as_sdtp=on&q='+search_query

    url = URI.parse(url)
    page = Net::HTTP.new(url.host).get(url.path + query).body

    if page =~ /of about <b>([0-9,]*)<\/b>\./
      return $1
    else
      return nil
    end

number_of_results(ARGV.join(' '))

and call from terminal/console search.rb search term

and if you have array of terms

['foo','bar','baz','quux'].each {|term|
  puts number_of_results(term)
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top