gscholar 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a928bc754b26578753527fde89ad8c7b502e11ce
4
- data.tar.gz: e43c195709f89aefdf22a0c406cd9f9cdcea6dc0
3
+ metadata.gz: 2669d1d2d695b3bcb6d1b88e2016e2d0b02e311c
4
+ data.tar.gz: 14ac8268773ef4e9d21235a91022a10be3516421
5
5
  SHA512:
6
- metadata.gz: 3e8b65a227ed1d91e9b7ec3ac48b4dbb9a2f36b6178e211510e1bcb7ed798091462ae4374c5a9f96ad0786e230ed3b6f3fc11e4842008f66f27ca6cf73bcc9c4
7
- data.tar.gz: 4ae1dc7288ba7bbe244b63159bf3317c749fce27bb25961f4baf07db1a02326d5704f1dd5b3cf44c1d85eff09dd4c15ea5f4b0c0f37fc323e1828c644a4c10f6
6
+ metadata.gz: 115852d9045539ee449b8ac9891404a9b17f2f58b94833aa646a8248ae8c9dfd2f6c0a333641f99046e99096589ed7bb52e1317ea903928d94c5fc023078bb9e
7
+ data.tar.gz: 0336f2bcbe1f17ecfd0e7e23a31314cf2b77d58f5759d95c8ba08af1d9f402255b6fffef83c79a16edb634d0eb2d63f00c84451ee91bff5d680eb987a89b098f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/gscholar.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "gscholar"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zifei Tong"]
@@ -10,11 +10,12 @@ module GScholar
10
10
  @agent.pluggable_parser['text/plain'] = TextPlainParser
11
11
  # Without changing user-agent, google will not return utf-8 page
12
12
  @agent.user_agent_alias = 'Mac Safari'
13
+ hack
14
+ end
13
15
 
14
- # hack to enable BibTeX download
15
- scisig = @agent.get('http://scholar.google.com/scholar_settings').
16
- form_with(:action => "/scholar_setprefs").field_with(:name => 'scisig').value
17
- @agent.get("http://scholar.google.com/scholar_setprefs?scisig=#{scisig}&num=20&scis=yes&scisf=4&instq=&save=")
16
+ def reset
17
+ @agent.reset
18
+ hack
18
19
  end
19
20
 
20
21
  def fetch(url)
@@ -23,13 +24,21 @@ module GScholar
23
24
  rescue Mechanize::ResponseCodeError => e
24
25
  case e.response_code
25
26
  when 403
26
- @agent.reset
27
+ reset
27
28
  retry
28
29
  else
29
30
  raise
30
31
  end
31
32
  end
32
33
  end
34
+
35
+ private
36
+ # hack to enable BibTeX download
37
+ def hack
38
+ scisig = @agent.get('http://scholar.google.com/scholar_settings').
39
+ form_with(:action => "/scholar_setprefs").field_with(:name => 'scisig').value
40
+ @agent.get("http://scholar.google.com/scholar_setprefs?scisig=#{scisig}&num=20&scis=yes&scisf=4&instq=&save=")
41
+ end
33
42
  end
34
43
 
35
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gscholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zifei Tong