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 +4 -4
- data/VERSION +1 -1
- data/gscholar.gemspec +1 -1
- data/lib/gscholar/utils/fetcher.rb +14 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2669d1d2d695b3bcb6d1b88e2016e2d0b02e311c
|
4
|
+
data.tar.gz: 14ac8268773ef4e9d21235a91022a10be3516421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 115852d9045539ee449b8ac9891404a9b17f2f58b94833aa646a8248ae8c9dfd2f6c0a333641f99046e99096589ed7bb52e1317ea903928d94c5fc023078bb9e
|
7
|
+
data.tar.gz: 0336f2bcbe1f17ecfd0e7e23a31314cf2b77d58f5759d95c8ba08af1d9f402255b6fffef83c79a16edb634d0eb2d63f00c84451ee91bff5d680eb987a89b098f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/gscholar.gemspec
CHANGED
@@ -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
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
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
|