google-cse 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +1 -0
- data/google-cse.gemspec +23 -0
- data/lib/google_cse.rb +44 -0
- data/lib/google_cse/query.rb +67 -0
- data/lib/google_cse/result.rb +16 -0
- data/lib/google_cse/version.rb +3 -0
- data/spec/files/google_image_search.txt +239 -0
- data/spec/files/google_search.txt +546 -0
- data/spec/files/google_search_page2.txt +394 -0
- data/spec/google_cse_spec.rb +120 -0
- data/spec/spec_helper.rb +10 -0
- metadata +101 -0
@@ -0,0 +1,394 @@
|
|
1
|
+
{
|
2
|
+
"kind": "customsearch#search",
|
3
|
+
"url": {
|
4
|
+
"type": "application/json",
|
5
|
+
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
|
6
|
+
},
|
7
|
+
"queries": {
|
8
|
+
"nextPage": [
|
9
|
+
{
|
10
|
+
"title": "Google Custom Search - ian kilminster",
|
11
|
+
"totalResults": "4900",
|
12
|
+
"searchTerms": "ian kilminster",
|
13
|
+
"count": 10,
|
14
|
+
"startIndex": 21,
|
15
|
+
"inputEncoding": "utf8",
|
16
|
+
"outputEncoding": "utf8",
|
17
|
+
"safe": "off",
|
18
|
+
"cx": "004660295420853704579:8tths02yqhc"
|
19
|
+
}
|
20
|
+
],
|
21
|
+
"request": [
|
22
|
+
{
|
23
|
+
"title": "Google Custom Search - ian kilminster",
|
24
|
+
"totalResults": "4900",
|
25
|
+
"searchTerms": "ian kilminster",
|
26
|
+
"count": 10,
|
27
|
+
"startIndex": 11,
|
28
|
+
"inputEncoding": "utf8",
|
29
|
+
"outputEncoding": "utf8",
|
30
|
+
"safe": "off",
|
31
|
+
"cx": "004660295420853704579:8tths02yqhc"
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"previousPage": [
|
35
|
+
{
|
36
|
+
"title": "Google Custom Search - ian kilminster",
|
37
|
+
"totalResults": "4900",
|
38
|
+
"searchTerms": "ian kilminster",
|
39
|
+
"count": 10,
|
40
|
+
"startIndex": 1,
|
41
|
+
"inputEncoding": "utf8",
|
42
|
+
"outputEncoding": "utf8",
|
43
|
+
"safe": "off",
|
44
|
+
"cx": "004660295420853704579:8tths02yqhc"
|
45
|
+
}
|
46
|
+
]
|
47
|
+
},
|
48
|
+
"context": {
|
49
|
+
"title": "Xegesis Images"
|
50
|
+
},
|
51
|
+
"searchInformation": {
|
52
|
+
"searchTime": 0.161328,
|
53
|
+
"formattedSearchTime": "0.16",
|
54
|
+
"totalResults": "4900",
|
55
|
+
"formattedTotalResults": "4,900"
|
56
|
+
},
|
57
|
+
"items": [
|
58
|
+
{
|
59
|
+
"kind": "customsearch#result",
|
60
|
+
"title": "Ian Fraser Kilmister Discography at Discogs",
|
61
|
+
"htmlTitle": "\u003cb\u003eIan\u003c/b\u003e Fraser \u003cb\u003eKilmister\u003c/b\u003e Discography at Discogs",
|
62
|
+
"link": "http://www.discogs.com/artist/Ian+Fraser+Kilmister",
|
63
|
+
"displayLink": "www.discogs.com",
|
64
|
+
"snippet": "Ian Fraser Kilmister. Real Name: Ian Fraser Kilmister. Profile: Born December 24, 1945, Stoke-On-Trent, Staffordshire, England. Sites: imotorhead.com ...",
|
65
|
+
"htmlSnippet": "\u003cb\u003eIan\u003c/b\u003e Fraser \u003cb\u003eKilmister\u003c/b\u003e. Real Name: \u003cb\u003eIan\u003c/b\u003e Fraser \u003cb\u003eKilmister\u003c/b\u003e. Profile: Born December 24, \u003cbr\u003e 1945, Stoke-On-Trent, Staffordshire, England. Sites: imotorhead.com \u003cb\u003e...\u003c/b\u003e",
|
66
|
+
"cacheId": "-s-5TkfXmBkJ",
|
67
|
+
"formattedUrl": "www.discogs.com/artist/Ian+Fraser+Kilmister",
|
68
|
+
"htmlFormattedUrl": "www.discogs.com/artist/\u003cb\u003eIan\u003c/b\u003e+Fraser+\u003cb\u003eKilmister\u003c/b\u003e",
|
69
|
+
"pagemap": {
|
70
|
+
"cse_image": [
|
71
|
+
{
|
72
|
+
"src": "http://s.discogss.com/image/A-90-1226750-1233004263.jpeg"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"cse_thumbnail": [
|
76
|
+
{
|
77
|
+
"width": "86",
|
78
|
+
"height": "57",
|
79
|
+
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS4g0Ve7I0jeLysyCGT8o4Xs2qie7R690BjET9ra6teXFOHAfoGGec7"
|
80
|
+
}
|
81
|
+
],
|
82
|
+
"metatags": [
|
83
|
+
{
|
84
|
+
"og:url": "http://www.discogs.com/artist/Ian+Fraser+Kilmister",
|
85
|
+
"og:site_name": "Discogs",
|
86
|
+
"twitter:card": "summary",
|
87
|
+
"og:type": "musician",
|
88
|
+
"fb:app_id": "117175028305858",
|
89
|
+
"og:title": "Ian Fraser Kilmister",
|
90
|
+
"twitter:site": "@discogs",
|
91
|
+
"og:image": "http://s.discogss.com/image/A-90-1226750-1233004263.jpeg"
|
92
|
+
}
|
93
|
+
]
|
94
|
+
}
|
95
|
+
},
|
96
|
+
{
|
97
|
+
"kind": "customsearch#result",
|
98
|
+
"title": "SF and Fantasy Masterworks: Michael Moorcock, The History of the ...",
|
99
|
+
"htmlTitle": "SF and Fantasy Masterworks: Michael Moorcock, The History of the \u003cb\u003e...\u003c/b\u003e",
|
100
|
+
"link": "http://www.sfandfantasymasterworks.co.uk/2010/05/michael-moorcock-history-of-runestaff.html",
|
101
|
+
"displayLink": "www.sfandfantasymasterworks.co.uk",
|
102
|
+
"snippet": "May 31, 2010... an assiduous editorial history, no-one appears to have picked up on the fact that Moorcock's co-dedicatee, 'my friend Mr Ian Kilminster' (sic; ...",
|
103
|
+
"htmlSnippet": "May 31, 2010\u003cb\u003e...\u003c/b\u003e an assiduous editorial history, no-one appears to have picked up on the fact \u003cbr\u003e that Moorcock's co-dedicatee, 'my friend Mr \u003cb\u003eIan Kilminster\u003c/b\u003e' (sic; \u003cb\u003e...\u003c/b\u003e",
|
104
|
+
"cacheId": "Q0fjGU43QgEJ",
|
105
|
+
"formattedUrl": "www.sfandfantasymasterworks.co.uk/.../michael-moorcock-history-of- runestaff.html",
|
106
|
+
"htmlFormattedUrl": "www.sfandfantasymasterworks.co.uk/.../michael-moorcock-history-of- runestaff.html",
|
107
|
+
"pagemap": {
|
108
|
+
"cse_image": [
|
109
|
+
{
|
110
|
+
"src": "http://1.bp.blogspot.com/_Zg1NISPoCIA/TAPhMihBI8I/AAAAAAAAA2E/c8v47MN6wyI/s320/Runestaff.jpg"
|
111
|
+
}
|
112
|
+
],
|
113
|
+
"person": [
|
114
|
+
{
|
115
|
+
"name": "Andrew Spong"
|
116
|
+
}
|
117
|
+
],
|
118
|
+
"cse_thumbnail": [
|
119
|
+
{
|
120
|
+
"width": "166",
|
121
|
+
"height": "256",
|
122
|
+
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcS1PUiAgSERWy5DeuHVJjYxaQZKPE_y5pCQFH1qaaWQETGighgZXteFasE"
|
123
|
+
}
|
124
|
+
],
|
125
|
+
"metatags": [
|
126
|
+
{
|
127
|
+
"viewport": "width=1100"
|
128
|
+
}
|
129
|
+
],
|
130
|
+
"blogposting": [
|
131
|
+
{
|
132
|
+
"image_url": "http://1.bp.blogspot.com/_Zg1NISPoCIA/TAPhMihBI8I/AAAAAAAAA2E/c8v47MN6wyI/s72-c/Runestaff.jpg",
|
133
|
+
"blogid": "15774680",
|
134
|
+
"postid": "5203741573449552719",
|
135
|
+
"name": "Michael Moorcock, The History of the Runestaff (1967-69, rev. 1977, rev. 1992) FMW 36",
|
136
|
+
"description": "First there was the Red Amulet, its ruddy light staining their faces as if with blood. This was Hawkmoon's strength, giving its owner more than natural energy. Then there were the crystal rings...",
|
137
|
+
"articlebody": "First there was the Red Amulet, its ruddy light staining their faces as if with blood. This was Hawkmoon's strength, giving its owner more than natural energy. Then there were the crystal rings...",
|
138
|
+
"url": "http://www.sfandfantasymasterworks.co.uk/2010/05/michael-moorcock-history-of-runestaff.html",
|
139
|
+
"datepublished": "9:17 AM"
|
140
|
+
}
|
141
|
+
]
|
142
|
+
}
|
143
|
+
},
|
144
|
+
{
|
145
|
+
"kind": "customsearch#result",
|
146
|
+
"title": "Pub Quiz Reference - Real Names of Celebrities",
|
147
|
+
"htmlTitle": "Pub Quiz Reference - Real Names of Celebrities",
|
148
|
+
"link": "http://www.pubquizreference.co.uk/main/real-names.html",
|
149
|
+
"displayLink": "www.pubquizreference.co.uk",
|
150
|
+
"snippet": "Peggy Lee, Norma Egstrom, Singer. Janet Leigh, Jeanette Morrison, Actress. Vivien Leigh, Vivien Hartley, Actress. Lemmy, Ian Kilminster, Singer ( Motorhead) ...",
|
151
|
+
"htmlSnippet": "Peggy Lee, Norma Egstrom, Singer. Janet Leigh, Jeanette Morrison, Actress. \u003cbr\u003e Vivien Leigh, Vivien Hartley, Actress. Lemmy, \u003cb\u003eIan Kilminster\u003c/b\u003e, Singer ( Motorhead) \u003cb\u003e...\u003c/b\u003e",
|
152
|
+
"cacheId": "Lvx5F3XsUJsJ",
|
153
|
+
"formattedUrl": "www.pubquizreference.co.uk/main/real-names.html",
|
154
|
+
"htmlFormattedUrl": "www.pubquizreference.co.uk/main/real-names.html"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"kind": "customsearch#result",
|
158
|
+
"title": "Marcus Berkmann: No such thing as selling out - Commentators ...",
|
159
|
+
"htmlTitle": "Marcus Berkmann: No such thing as selling out - Commentators \u003cb\u003e...\u003c/b\u003e",
|
160
|
+
"link": "http://www.independent.co.uk/voices/commentators/marcus-berkmann-no-such-thing-as-selling-out-2112070.html",
|
161
|
+
"displayLink": "www.independent.co.uk",
|
162
|
+
"snippet": "The startling news arrives that Mr Ian Kilminster, popularly and legendarily known as Lemmy, is to re-record his band Motorhead's greatest hit \"Ace Of Spades\" ...",
|
163
|
+
"htmlSnippet": "The startling news arrives that Mr \u003cb\u003eIan Kilminster\u003c/b\u003e, popularly and legendarily known \u003cbr\u003e as Lemmy, is to re-record his band Motorhead's greatest hit "Ace Of Spades" \u003cb\u003e...\u003c/b\u003e",
|
164
|
+
"cacheId": "uAWnpcJFLU0J",
|
165
|
+
"formattedUrl": "www.independent.co.uk/.../marcus-berkmann-no-such-thing-as-selling-out- 2112070.html",
|
166
|
+
"htmlFormattedUrl": "www.independent.co.uk/.../marcus-berkmann-no-such-thing-as-selling-out- 2112070.html",
|
167
|
+
"pagemap": {
|
168
|
+
"cse_image": [
|
169
|
+
{
|
170
|
+
"src": "http://www.independent.co.uk/incoming/article8193086.ece/ALTERNATES/w140/jimy+saville.jpg"
|
171
|
+
}
|
172
|
+
],
|
173
|
+
"cse_thumbnail": [
|
174
|
+
{
|
175
|
+
"width": "112",
|
176
|
+
"height": "84",
|
177
|
+
"src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcQIqt_uRlkgfidOyoVkBB61bNk-R2WO2qdAEHbiof0lxpEIy9jWRZRHow"
|
178
|
+
}
|
179
|
+
],
|
180
|
+
"metatags": [
|
181
|
+
{
|
182
|
+
"og:title": "Marcus Berkmann: No such thing as selling out",
|
183
|
+
"og:type": "article",
|
184
|
+
"og:image": "http://www.independent.co.uk/skins/ind/images/eagle_logo.jpg",
|
185
|
+
"og:description": "The startling news arrives that Mr Ian Kilminster, popularly and legendarily known as Lemmy, is to re-record his band Motorhead's greatest hit \"Ace Of Spades\" for a beer commercial. The great shock is, of course, that he hasn't done this before. An estimated 7,948 beer commercials have been produced since \"Ace Of Spades\" first graced the British charts in 1980, reaching a respectable number 15. But not one of them has featured Lemmy's raddled, eye-watering rasp, a voice that seems to say, \"Drink a lot of this and you could sound like me too\". As happens too rarely in the advertising industry, product and celebrity endorser have come together in perfect harmony. Or at least, rather more pleasing harmony than any you'll find on a Motorhead record.",
|
186
|
+
"article:tag": "Sony",
|
187
|
+
"article:published_time": "2010-10-21",
|
188
|
+
"article:section": "Commentators",
|
189
|
+
"og:url": "http://www.independent.co.uk/voices/commentators/marcus-berkmann-no-such-thing-as-selling-out-2112070.html",
|
190
|
+
"fb:app_id": "235586169789578",
|
191
|
+
"fb:admins": "36903991,100001802971061,500243253",
|
192
|
+
"og:site_name": "The Independent",
|
193
|
+
"og:locale": "en_GB"
|
194
|
+
}
|
195
|
+
]
|
196
|
+
}
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"kind": "customsearch#result",
|
200
|
+
"title": "Ian Kilminster | Facebook",
|
201
|
+
"htmlTitle": "\u003cb\u003eIan Kilminster\u003c/b\u003e | Facebook",
|
202
|
+
"link": "http://en-gb.facebook.com/ian.kilminster.94",
|
203
|
+
"displayLink": "en-gb.facebook.com",
|
204
|
+
"snippet": "Ian Kilminster is on Facebook. Join Facebook to connect with Ian Kilminster and others you may know. Facebook gives people the power to share and makes ...",
|
205
|
+
"htmlSnippet": "\u003cb\u003eIan Kilminster\u003c/b\u003e is on Facebook. Join Facebook to connect with \u003cb\u003eIan Kilminster\u003c/b\u003e and \u003cbr\u003e others you may know. Facebook gives people the power to share and makes \u003cb\u003e...\u003c/b\u003e",
|
206
|
+
"cacheId": "K_Z8qjaKJqAJ",
|
207
|
+
"formattedUrl": "en-gb.facebook.com/ian.kilminster.94",
|
208
|
+
"htmlFormattedUrl": "en-gb.facebook.com/\u003cb\u003eian\u003c/b\u003e.\u003cb\u003ekilminster\u003c/b\u003e.94",
|
209
|
+
"pagemap": {
|
210
|
+
"person": [
|
211
|
+
{
|
212
|
+
"image": "http://profile.ak.fbcdn.net/hprofile-ak-snc6/273740_614991441_609013572_q.jpg",
|
213
|
+
"name": "Ian Kilminster (Kilsey)"
|
214
|
+
}
|
215
|
+
],
|
216
|
+
"metatags": [
|
217
|
+
{
|
218
|
+
"referrer": "default"
|
219
|
+
}
|
220
|
+
]
|
221
|
+
}
|
222
|
+
},
|
223
|
+
{
|
224
|
+
"kind": "customsearch#result",
|
225
|
+
"title": "Lemmy bass tabs and techniques",
|
226
|
+
"htmlTitle": "Lemmy bass tabs and techniques",
|
227
|
+
"link": "http://www.guitarmagazine.co.uk/articles/lemmy-bass-tabs-and-techniques/",
|
228
|
+
"displayLink": "www.guitarmagazine.co.uk",
|
229
|
+
"snippet": "Apr 20, 2009 ... Born Ian Fraser Kilminster in Stoke on Christmas Eve, 1945, Lemmy joined Hawkwind as a bass player in 1971 and contributed lead vocals to ...",
|
230
|
+
"htmlSnippet": "Apr 20, 2009 \u003cb\u003e...\u003c/b\u003e Born \u003cb\u003eIan\u003c/b\u003e Fraser \u003cb\u003eKilminster\u003c/b\u003e in Stoke on Christmas Eve, 1945, Lemmy joined \u003cbr\u003e Hawkwind as a bass player in 1971 and contributed lead vocals to \u003cb\u003e...\u003c/b\u003e",
|
231
|
+
"cacheId": "mUt3whSXOgAJ",
|
232
|
+
"formattedUrl": "www.guitarmagazine.co.uk/articles/lemmy-bass-tabs-and-techniques/",
|
233
|
+
"htmlFormattedUrl": "www.guitarmagazine.co.uk/articles/lemmy-bass-tabs-and-techniques/",
|
234
|
+
"pagemap": {
|
235
|
+
"cse_image": [
|
236
|
+
{
|
237
|
+
"src": "http://www.guitarmagazine.co.uk/img_cache/tagged/400/716693b4-2937-11e0-9e31-002215530376.jpg"
|
238
|
+
}
|
239
|
+
],
|
240
|
+
"cse_thumbnail": [
|
241
|
+
{
|
242
|
+
"width": "187",
|
243
|
+
"height": "269",
|
244
|
+
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRrmHvjj3gjmh20SJ5z0B8tF9EefJe_Zq-GiHGgd_fZdDLE29CufLDl55_S"
|
245
|
+
}
|
246
|
+
]
|
247
|
+
}
|
248
|
+
},
|
249
|
+
{
|
250
|
+
"kind": "customsearch#result",
|
251
|
+
"title": "Julian Cope presents Head Heritage | Unsung | The Book of Seth ...",
|
252
|
+
"htmlTitle": "Julian Cope presents Head Heritage | Unsung | The Book of Seth \u003cb\u003e...\u003c/b\u003e",
|
253
|
+
"link": "http://www.headheritage.co.uk/unsung/thebookofseth/hawkwind-kings-of-speed-motorhead",
|
254
|
+
"displayLink": "www.headheritage.co.uk",
|
255
|
+
"snippet": "... Roger Dean-ian outcropping of astro turf ripped off from “Fragile” and waiting ... execution and theme was none other than his cohort Lemmy “Ian” Kilminster ...",
|
256
|
+
"htmlSnippet": "\u003cb\u003e...\u003c/b\u003e Roger Dean-ian outcropping of astro turf ripped off from “Fragile” and waiting \u003cb\u003e...\u003c/b\u003e \u003cbr\u003e execution and theme was none other than his cohort Lemmy “\u003cb\u003eIan\u003c/b\u003e” \u003cb\u003eKilminster\u003c/b\u003e \u003cb\u003e...\u003c/b\u003e",
|
257
|
+
"cacheId": "ORNcjlPDLDIJ",
|
258
|
+
"formattedUrl": "www.headheritage.co.uk/.../hawkwind-kings-of-speed-motorhead",
|
259
|
+
"htmlFormattedUrl": "www.headheritage.co.uk/.../hawkwind-kings-of-speed-motorhead",
|
260
|
+
"pagemap": {
|
261
|
+
"cse_image": [
|
262
|
+
{
|
263
|
+
"src": "http://www.headheritage.co.uk/unsung/reviews/covers_194/919.jpg"
|
264
|
+
}
|
265
|
+
],
|
266
|
+
"cse_thumbnail": [
|
267
|
+
{
|
268
|
+
"width": "155",
|
269
|
+
"height": "155",
|
270
|
+
"src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQgiGZNVgc4omb9Gyg4_0hLVqHhWhpH-q15eYLrjcAiVkQbdtwEOv5XVbQ"
|
271
|
+
}
|
272
|
+
],
|
273
|
+
"metatags": [
|
274
|
+
{
|
275
|
+
"fb:page_id": "360946197251883",
|
276
|
+
"fb:admins": "707436964",
|
277
|
+
"og:site_name": "Julian Cope presents Head Heritage",
|
278
|
+
"og:title": "The Book of Seth: Hawkwind — Kings Of Speed/Motorhead",
|
279
|
+
"og:url": "http://www.headheritage.co.uk/unsung/thebookofseth/hawkwind-kings-of-speed-motorhead",
|
280
|
+
"og:image": "http://www.headheritage.co.uk/unsung/reviews/covers_194/919.jpg"
|
281
|
+
}
|
282
|
+
]
|
283
|
+
}
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"kind": "customsearch#result",
|
287
|
+
"title": "Tonight's Motorhead gig cancelled at Colston Hall, Bristol | This is ...",
|
288
|
+
"htmlTitle": "Tonight's Motorhead gig cancelled at Colston Hall, Bristol | This is \u003cb\u003e...\u003c/b\u003e",
|
289
|
+
"link": "http://www.thisisbristol.co.uk/Tonight-s-Motorhead-gig-cancelled-Colston-Hall/story-13789134-detail/story.html",
|
290
|
+
"displayLink": "www.thisisbristol.co.uk",
|
291
|
+
"snippet": "Nov 8, 2011 ... Tuesday, November 08 2011, 7:46PM. “Schoolboy error. His name is NOT \" Lemmy Kilmister\", it's just \"Lemmy\". His real name is Ian Kilminster.” ...",
|
292
|
+
"htmlSnippet": "Nov 8, 2011 \u003cb\u003e...\u003c/b\u003e Tuesday, November 08 2011, 7:46PM. “Schoolboy error. His name is NOT "\u003cbr\u003e Lemmy Kilmister", it's just "Lemmy". His real name is \u003cb\u003eIan Kilminster\u003c/b\u003e.” \u003cb\u003e...\u003c/b\u003e",
|
293
|
+
"cacheId": "liUvG5V8FKwJ",
|
294
|
+
"formattedUrl": "www.thisisbristol.co.uk/Tonight-s-Motorhead-gig.../story.html",
|
295
|
+
"htmlFormattedUrl": "www.thisisbristol.co.uk/Tonight-s-Motorhead-gig.../story.html",
|
296
|
+
"pagemap": {
|
297
|
+
"cse_image": [
|
298
|
+
{
|
299
|
+
"src": "http://www.thisisbristol.co.uk/images/localpeople/ugc-images/275775/Article/images/13789134/3315106.png"
|
300
|
+
}
|
301
|
+
],
|
302
|
+
"cse_thumbnail": [
|
303
|
+
{
|
304
|
+
"width": "274",
|
305
|
+
"height": "184",
|
306
|
+
"src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQPsy4FUepSnrumaWYWDWa239XQZwe81j0DEyo6lR-9aOH1ORXVKsY2h7A"
|
307
|
+
}
|
308
|
+
],
|
309
|
+
"metatags": [
|
310
|
+
{
|
311
|
+
"y_key": "375f1bbd5088049b",
|
312
|
+
"msvalidate.01": "C1FC943041AC66B017981683C4A59C1E",
|
313
|
+
"fb:app_id": "250361805003247",
|
314
|
+
"fb:page_id": "132525063479352",
|
315
|
+
"og:site_name": "This isBristol",
|
316
|
+
"og:locale": "en_UK",
|
317
|
+
"og:type": "article",
|
318
|
+
"og:description": "MOTORHEAD'S gig at the Colston Hall tonight has been cancelled. One of the members of the heavy metal band has been injured, meaning the act will not be able to go on stage. Motorhead, led by Lemmy,...",
|
319
|
+
"og:title": "Tonight's Motorhead gig cancelled at Colston Hall, Bristol",
|
320
|
+
"og:image": "http://www.thisisbristol.co.uk/images/localpeople/ugc-images/275775/Article/images/13789134/3315106.png",
|
321
|
+
"og:url": "http://www.thisisbristol.co.uk/Tonight-s-Motorhead-gig-cancelled-Colston-Hall/story-13789134-detail/story.html",
|
322
|
+
"article:published_time": "2011-11-08T16:28:00+00:00",
|
323
|
+
"article:modified_time": "2011-11-08T17:23:53+00:00",
|
324
|
+
"article:author": "http://www.thisisbristol.co.ukhttp://www.thisisbristol.co.uk/people/This is Bristol/profile.html",
|
325
|
+
"article:tag": "UK news",
|
326
|
+
"og:section": "UK news",
|
327
|
+
"og:language": "en",
|
328
|
+
"decorator": "thisis-standard"
|
329
|
+
}
|
330
|
+
]
|
331
|
+
}
|
332
|
+
},
|
333
|
+
{
|
334
|
+
"kind": "customsearch#result",
|
335
|
+
"title": "DVD : Lemmy",
|
336
|
+
"htmlTitle": "DVD : Lemmy",
|
337
|
+
"link": "http://www.pennyblackmusic.co.uk/magsitepages/Article.aspx?id=5891",
|
338
|
+
"displayLink": "www.pennyblackmusic.co.uk",
|
339
|
+
"snippet": "Feb 21, 2011 ... Musical trends may come and go but Ian 'Lemmy' Kilminster will go on regardless doing his own thing. Watching 'Lemmy' you realise just how ...",
|
340
|
+
"htmlSnippet": "Feb 21, 2011 \u003cb\u003e...\u003c/b\u003e Musical trends may come and go but \u003cb\u003eIan\u003c/b\u003e 'Lemmy' \u003cb\u003eKilminster\u003c/b\u003e will go on regardless \u003cbr\u003e doing his own thing. Watching 'Lemmy' you realise just how \u003cb\u003e...\u003c/b\u003e",
|
341
|
+
"cacheId": "SgI3gd5kgJEJ",
|
342
|
+
"formattedUrl": "www.pennyblackmusic.co.uk/magsitepages/Article.aspx?id=5891",
|
343
|
+
"htmlFormattedUrl": "www.pennyblackmusic.co.uk/magsitepages/Article.aspx?id=5891",
|
344
|
+
"pagemap": {
|
345
|
+
"cse_image": [
|
346
|
+
{
|
347
|
+
"src": "http://www.pennyblackmusic.co.uk/PictureGallery/10366.jpg"
|
348
|
+
}
|
349
|
+
],
|
350
|
+
"cse_thumbnail": [
|
351
|
+
{
|
352
|
+
"width": "225",
|
353
|
+
"height": "225",
|
354
|
+
"src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRz_I9mlRZ2KCv5JnCfEOQdRlQuncdyzMm0NcVqLDQHEdzWBA6dtd3Pgfc"
|
355
|
+
}
|
356
|
+
],
|
357
|
+
"metatags": [
|
358
|
+
{
|
359
|
+
"classification": "Despite taking two years to make, Jon Rogers finds fly-on-the wall documentary 'Lemmy' to be lacking in insight and new information about the legendary Motorhead front man",
|
360
|
+
"code_language": "Visual Basic .NET 7.1",
|
361
|
+
"vs_defaultclientscript": "JavaScript",
|
362
|
+
"vs_targetschema": "http://schemas.microsoft.com/intellisense/ie5"
|
363
|
+
}
|
364
|
+
]
|
365
|
+
}
|
366
|
+
},
|
367
|
+
{
|
368
|
+
"kind": "customsearch#result",
|
369
|
+
"title": "About Us | Health Care In Christ",
|
370
|
+
"htmlTitle": "About Us | Health Care In Christ",
|
371
|
+
"link": "http://www.hcic.org.au/content/about-us",
|
372
|
+
"displayLink": "www.hcic.org.au",
|
373
|
+
"snippet": "Ian Kilminster, Director In the 40 years that I have worked as a pharmacist in a public hospital, the Lord gave me grace to care & pray for the members of my ...",
|
374
|
+
"htmlSnippet": "\u003cb\u003eIan Kilminster\u003c/b\u003e, Director In the 40 years that I have worked as a pharmacist in a \u003cbr\u003e public hospital, the Lord gave me grace to care & pray for the members of my \u003cb\u003e...\u003c/b\u003e",
|
375
|
+
"cacheId": "bJO0nTQ5aUMJ",
|
376
|
+
"formattedUrl": "www.hcic.org.au/content/about-us",
|
377
|
+
"htmlFormattedUrl": "www.hcic.org.au/content/about-us",
|
378
|
+
"pagemap": {
|
379
|
+
"cse_image": [
|
380
|
+
{
|
381
|
+
"src": "http://www.hcic.org.au/sites/default/files/about3.jpg"
|
382
|
+
}
|
383
|
+
],
|
384
|
+
"cse_thumbnail": [
|
385
|
+
{
|
386
|
+
"width": "280",
|
387
|
+
"height": "146",
|
388
|
+
"src": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTzCNAua7EaiZ3W32aBiPu_P8Z8KSrtSjcJ67Vv0xDeNY8e3R27IUL9iGQS"
|
389
|
+
}
|
390
|
+
]
|
391
|
+
}
|
392
|
+
}
|
393
|
+
]
|
394
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GoogleCSE do
|
4
|
+
subject { GoogleCSE }
|
5
|
+
|
6
|
+
describe 'without config' do
|
7
|
+
before {
|
8
|
+
GoogleCSE.send(:remove_const, :CX)
|
9
|
+
GoogleCSE.send(:remove_const, :KEY)
|
10
|
+
}
|
11
|
+
|
12
|
+
after {
|
13
|
+
GoogleCSE::CX = 'cse-identifier'
|
14
|
+
GoogleCSE::KEY = 'custom-search-key'
|
15
|
+
}
|
16
|
+
|
17
|
+
it { expect {subject.search('lemmy')}.to raise_error(GoogleCSE::MissingCX) }
|
18
|
+
it { expect {subject.image_search('lemmy')}.to raise_error(GoogleCSE::MissingCX) }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'with only key' do
|
22
|
+
before {
|
23
|
+
GoogleCSE.send(:remove_const, :CX)
|
24
|
+
}
|
25
|
+
|
26
|
+
after {
|
27
|
+
GoogleCSE::CX = 'cse-identifier'
|
28
|
+
}
|
29
|
+
|
30
|
+
it { expect {subject.search('lemmy')}.to raise_error(GoogleCSE::MissingCX) }
|
31
|
+
it { expect {subject.image_search('lemmy')}.to raise_error(GoogleCSE::MissingCX) }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'with only cx' do
|
35
|
+
before {
|
36
|
+
GoogleCSE.send(:remove_const, :KEY)
|
37
|
+
}
|
38
|
+
|
39
|
+
after {
|
40
|
+
GoogleCSE::KEY = 'custom-search-key'
|
41
|
+
}
|
42
|
+
|
43
|
+
it { expect {subject.search('lemmy')}.to raise_error(GoogleCSE::MissingKey) }
|
44
|
+
it { expect {subject.image_search('lemmy')}.to raise_error(GoogleCSE::MissingKey ) }
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'with config' do
|
48
|
+
it { subject.search('lemmy').should be_a(GoogleCSE::Query) }
|
49
|
+
it { subject.image_search('lemmy').should be_a(GoogleCSE::Query) }
|
50
|
+
|
51
|
+
describe '#search' do
|
52
|
+
subject { GoogleCSE.search('lemmy') }
|
53
|
+
before {
|
54
|
+
subject.stub(:fetch) {
|
55
|
+
subject.response = JSON.parse(File.read('./spec/files/google_search.txt'))
|
56
|
+
subject.parse_response!
|
57
|
+
subject
|
58
|
+
}
|
59
|
+
subject.fetch
|
60
|
+
}
|
61
|
+
|
62
|
+
it { subject.results.size.should eq(10) }
|
63
|
+
it { subject.results.first.link.should eq(subject.fetch.results.first['link']) }
|
64
|
+
it { subject.page.should eq(1) }
|
65
|
+
it { subject.current_index.should eq(1) }
|
66
|
+
it { subject.per_page.should eq(10) }
|
67
|
+
|
68
|
+
describe 'next' do
|
69
|
+
before {
|
70
|
+
subject.stub(:next) {
|
71
|
+
subject.response = JSON.parse(File.read('./spec/files/google_search_page2.txt'))
|
72
|
+
subject.parse_response!
|
73
|
+
subject
|
74
|
+
}
|
75
|
+
subject.fetch
|
76
|
+
}
|
77
|
+
|
78
|
+
it { subject.next?.should eq(true) }
|
79
|
+
it { subject.next.should eq(subject) }
|
80
|
+
it { subject.next.current_index.should eq(11) }
|
81
|
+
it { subject.next.page.should eq(2) }
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'previous' do
|
85
|
+
before {
|
86
|
+
subject.stub(:next) {
|
87
|
+
subject.response = JSON.parse(File.read('./spec/files/google_search_page2.txt'))
|
88
|
+
subject.parse_response!
|
89
|
+
subject
|
90
|
+
}
|
91
|
+
subject.stub(:previous) {
|
92
|
+
subject.response = JSON.parse(File.read('./spec/files/google_search.txt'))
|
93
|
+
subject.parse_response!
|
94
|
+
subject
|
95
|
+
}
|
96
|
+
subject.fetch.next
|
97
|
+
}
|
98
|
+
|
99
|
+
it { subject.previous?.should eq(true) }
|
100
|
+
it { subject.previous.should eq(subject) }
|
101
|
+
it { subject.previous.current_index.should eq(1) }
|
102
|
+
it { subject.previous.page.should eq(1) }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
describe '#image_search' do
|
107
|
+
subject { GoogleCSE.image_search('lemmy') }
|
108
|
+
before {
|
109
|
+
subject.stub(:fetch) {
|
110
|
+
subject.response = JSON.parse(File.read('./spec/files/google_image_search.txt'))
|
111
|
+
subject.parse_response!
|
112
|
+
subject
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
it { subject.fetch.results.size.should eq(10) }
|
117
|
+
it { subject.fetch.results.first.link.should eq(subject.fetch.results.first['link']) }
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|