baidu 2.0.9 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +358 -400
- data/lib/baidu/sem/rank.rb +3 -3
- data/lib/baidu/version.rb +1 -1
- metadata +2 -9
- data/lib/baidu/map.rb +0 -98
- data/lib/baidu/map/geocoder.rb +0 -47
- data/lib/baidu/map/request.rb +0 -6
- data/lib/baidu/map/result.rb +0 -6
- data/lib/baidu/sem/rankservice.rb +0 -7
- data/spec/map_spec.rb +0 -77
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c91194da47b015b6f091fb2bac69e17a6e034d22
|
|
4
|
+
data.tar.gz: bad77d6536394788c6e8621cf88c61abbba46af6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 842199f1dbfca36870ff4824aebaddc57ff5b7bbf73ab11fe05c42d66d159d9ac70988ab783574ba54aaaabf98436c1fb3c941e6c1402c68f8c0d0ecb5bb5e27
|
|
7
|
+
data.tar.gz: 56ee3b417f30e46ad802249e70a271588180ef564bea0b3e01ac4eae1f7cfaaf1c59cd8a9080a098032eeef36f8f5a81ea108fa527df5654d5b100cab3eb6222
|
data/README.md
CHANGED
|
@@ -27,7 +27,6 @@ snake命名法,用于response数据格式
|
|
|
27
27
|
|
|
28
28
|
```ruby
|
|
29
29
|
|
|
30
|
-
BAIDU_MAP_KEY = ''
|
|
31
30
|
$username = ''
|
|
32
31
|
$password = ''
|
|
33
32
|
$token = ''
|
|
@@ -51,28 +50,6 @@ res = ss.getKeywordBySearch({:searchWord=>'word',:searchType=>0})
|
|
|
51
50
|
res = ss.getKeywordBySearch({:searchWord=>'word',:searchType=>0},true) #debug=true
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
MAP
|
|
55
|
-
|
|
56
|
-
```ruby
|
|
57
|
-
#返回码 定义 英文返回描述
|
|
58
|
-
#0 正常 ok
|
|
59
|
-
#2 请求参数非法 Parameter Invalid
|
|
60
|
-
#3 权限校验失败 Verify Failure
|
|
61
|
-
#4 配额校验失败 Quota Failure
|
|
62
|
-
#5 ak不存在或者非法 AK Failure
|
|
63
|
-
#2xx 无权限
|
|
64
|
-
#3xx 配额错误
|
|
65
|
-
puts map.get_xy_by_poiname('滨海公园','上海')
|
|
66
|
-
map = Baidu::Map.new('key')
|
|
67
|
-
require 'awesome_print'
|
|
68
|
-
lat = 40.3377039331399
|
|
69
|
-
lng = 116.647588831718
|
|
70
|
-
ap map.bus.around(lat,lng).info
|
|
71
|
-
puts map.get(39.911031821584,116.44931548023).for(1000).bus
|
|
72
|
-
puts map.geo('22.53','113.38')
|
|
73
|
-
Baidumap.get_baike('北京站')
|
|
74
|
-
Baidumap.get_cityid('北京') #=>131
|
|
75
|
-
```
|
|
76
53
|
|
|
77
54
|
##Documents
|
|
78
55
|
|
|
@@ -115,383 +92,364 @@ data | String | 使用gzip进行压缩的推广实况的HTML数据, 解压缩
|
|
|
115
92
|
地域代码 地域名称
|
|
116
93
|
|
|
117
94
|
```
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
291 文山
|
|
477
|
-
292 大理
|
|
478
|
-
293 红河
|
|
479
|
-
294 昭通
|
|
480
|
-
295 玉溪
|
|
481
|
-
481 怒江
|
|
482
|
-
482 迪庆
|
|
483
|
-
483 西双版纳
|
|
484
|
-
272 金华
|
|
485
|
-
273 嘉兴
|
|
486
|
-
274 衢州
|
|
487
|
-
275 丽水
|
|
488
|
-
276 宁波
|
|
489
|
-
277 绍兴
|
|
490
|
-
278 温州
|
|
491
|
-
279 台州
|
|
492
|
-
280 杭州
|
|
493
|
-
281 舟山
|
|
494
|
-
282 湖州
|
|
95
|
+
4085 潮州
|
|
96
|
+
4116 东莞
|
|
97
|
+
4090 佛山
|
|
98
|
+
4084 广州
|
|
99
|
+
4115 河源
|
|
100
|
+
4117 惠州
|
|
101
|
+
4082 江门
|
|
102
|
+
4083 揭阳
|
|
103
|
+
4086 茂名
|
|
104
|
+
4088 梅州
|
|
105
|
+
4089 清远
|
|
106
|
+
4091 汕头
|
|
107
|
+
4092 汕尾
|
|
108
|
+
4094 韶关
|
|
109
|
+
4093 深圳
|
|
110
|
+
4109 阳江
|
|
111
|
+
4111 云浮
|
|
112
|
+
4110 湛江
|
|
113
|
+
4114 肇庆
|
|
114
|
+
4112 中山
|
|
115
|
+
4113 珠海
|
|
116
|
+
5081 福州
|
|
117
|
+
5050 龙岩
|
|
118
|
+
5049 南平
|
|
119
|
+
5051 宁德
|
|
120
|
+
5048 莆田
|
|
121
|
+
5052 泉州
|
|
122
|
+
5066 三明
|
|
123
|
+
5070 厦门
|
|
124
|
+
5080 漳州
|
|
125
|
+
8493 白沙黎族自治县
|
|
126
|
+
8488 保亭黎族苗族自治县
|
|
127
|
+
8492 昌江黎族自治县
|
|
128
|
+
8487 澄迈县
|
|
129
|
+
8303 儋州
|
|
130
|
+
8484 定安县
|
|
131
|
+
8296 东方
|
|
132
|
+
8302 海口
|
|
133
|
+
8490 乐东黎族自治县
|
|
134
|
+
8491 临高县
|
|
135
|
+
8486 陵水黎族自治县
|
|
136
|
+
8297 琼海
|
|
137
|
+
8489 琼中黎族苗族自治县
|
|
138
|
+
8298 三亚
|
|
139
|
+
8485 屯昌县
|
|
140
|
+
8301 万宁
|
|
141
|
+
8299 文昌
|
|
142
|
+
8300 五指山
|
|
143
|
+
9128 安庆
|
|
144
|
+
9141 蚌埠
|
|
145
|
+
9143 亳州
|
|
146
|
+
9129 巢湖
|
|
147
|
+
9130 池州
|
|
148
|
+
9131 滁州
|
|
149
|
+
9140 阜阳
|
|
150
|
+
9142 合肥
|
|
151
|
+
9127 淮北
|
|
152
|
+
9133 淮南
|
|
153
|
+
9132 黄山
|
|
154
|
+
9135 六安
|
|
155
|
+
9134 马鞍山
|
|
156
|
+
9138 铜陵
|
|
157
|
+
9139 芜湖
|
|
158
|
+
9137 宿州
|
|
159
|
+
9136 宣城
|
|
160
|
+
10119 安顺
|
|
161
|
+
10124 毕节
|
|
162
|
+
10118 贵阳
|
|
163
|
+
10120 六盘水
|
|
164
|
+
10122 黔东南
|
|
165
|
+
10121 黔南
|
|
166
|
+
10123 黔西南
|
|
167
|
+
10125 铜仁
|
|
168
|
+
10126 遵义
|
|
169
|
+
11267 白银
|
|
170
|
+
11263 定西
|
|
171
|
+
11477 甘南
|
|
172
|
+
11257 嘉峪关
|
|
173
|
+
11256 金昌
|
|
174
|
+
11255 酒泉
|
|
175
|
+
11258 兰州
|
|
176
|
+
11261 临夏
|
|
177
|
+
11259 陇南
|
|
178
|
+
11260 平凉
|
|
179
|
+
11262 庆阳
|
|
180
|
+
11265 天水
|
|
181
|
+
11264 武威
|
|
182
|
+
11266 张掖
|
|
183
|
+
12108 百色
|
|
184
|
+
12104 北海
|
|
185
|
+
12478 崇左
|
|
186
|
+
12098 防城港
|
|
187
|
+
12096 贵港
|
|
188
|
+
12095 桂林
|
|
189
|
+
12106 河池
|
|
190
|
+
12107 贺州
|
|
191
|
+
12100 来宾
|
|
192
|
+
12101 柳州
|
|
193
|
+
12099 南宁
|
|
194
|
+
12102 钦州
|
|
195
|
+
12103 梧州
|
|
196
|
+
12105 玉林
|
|
197
|
+
13304 保定
|
|
198
|
+
13305 沧州
|
|
199
|
+
13306 承德
|
|
200
|
+
13330 邯郸
|
|
201
|
+
13332 衡水
|
|
202
|
+
13307 廊坊
|
|
203
|
+
13325 秦皇岛
|
|
204
|
+
13327 石家庄
|
|
205
|
+
13329 唐山
|
|
206
|
+
13326 邢台
|
|
207
|
+
13331 张家口
|
|
208
|
+
14309 安阳
|
|
209
|
+
14323 鹤壁
|
|
210
|
+
14476 济源
|
|
211
|
+
14308 焦作
|
|
212
|
+
14310 开封
|
|
213
|
+
14311 洛阳
|
|
214
|
+
14312 漯河
|
|
215
|
+
14315 南阳
|
|
216
|
+
14313 平顶山
|
|
217
|
+
14316 濮阳
|
|
218
|
+
14321 三门峡
|
|
219
|
+
14320 商丘
|
|
220
|
+
14317 新乡
|
|
221
|
+
14318 信阳
|
|
222
|
+
14319 许昌
|
|
223
|
+
14322 郑州
|
|
224
|
+
14324 周口
|
|
225
|
+
14314 驻马店
|
|
226
|
+
15342 大庆
|
|
227
|
+
15343 大兴安岭
|
|
228
|
+
15335 哈尔滨
|
|
229
|
+
15344 鹤岗
|
|
230
|
+
15345 黑河
|
|
231
|
+
15333 鸡西
|
|
232
|
+
15334 佳木斯
|
|
233
|
+
15336 牡丹江
|
|
234
|
+
15338 七台河
|
|
235
|
+
15337 齐齐哈尔
|
|
236
|
+
15340 双鸭山
|
|
237
|
+
15339 绥化
|
|
238
|
+
15341 伊春
|
|
239
|
+
16377 鄂州
|
|
240
|
+
16366 恩施
|
|
241
|
+
16349 黄冈
|
|
242
|
+
16348 黄石
|
|
243
|
+
16346 荆门
|
|
244
|
+
16347 荆州
|
|
245
|
+
16364 潜江
|
|
246
|
+
16368 神农架
|
|
247
|
+
16369 十堰
|
|
248
|
+
16367 随州
|
|
249
|
+
16373 天门
|
|
250
|
+
16371 武汉
|
|
251
|
+
16372 仙桃
|
|
252
|
+
16375 咸宁
|
|
253
|
+
16370 襄阳
|
|
254
|
+
16365 孝感
|
|
255
|
+
16376 宜昌
|
|
256
|
+
17351 常德
|
|
257
|
+
17353 郴州
|
|
258
|
+
17360 衡阳
|
|
259
|
+
17350 怀化
|
|
260
|
+
17354 娄底
|
|
261
|
+
17355 邵阳
|
|
262
|
+
17356 湘潭
|
|
263
|
+
17357 湘西
|
|
264
|
+
17359 益阳
|
|
265
|
+
17362 永州
|
|
266
|
+
17361 岳阳
|
|
267
|
+
17358 张家界
|
|
268
|
+
17352 长沙
|
|
269
|
+
17363 株洲
|
|
270
|
+
18039 白城
|
|
271
|
+
18042 白山
|
|
272
|
+
18038 吉林
|
|
273
|
+
18041 辽源
|
|
274
|
+
18043 四平
|
|
275
|
+
18044 松原
|
|
276
|
+
18045 通化
|
|
277
|
+
18047 延边
|
|
278
|
+
18040 长春
|
|
279
|
+
19054 常州
|
|
280
|
+
19053 淮安
|
|
281
|
+
19057 连云港
|
|
282
|
+
19055 南京
|
|
283
|
+
19056 南通
|
|
284
|
+
19059 苏州
|
|
285
|
+
19061 泰州
|
|
286
|
+
19062 无锡
|
|
287
|
+
19060 宿迁
|
|
288
|
+
19058 徐州
|
|
289
|
+
19063 盐城
|
|
290
|
+
19064 扬州
|
|
291
|
+
19065 镇江
|
|
292
|
+
20078 抚州
|
|
293
|
+
20077 赣州
|
|
294
|
+
20068 吉安
|
|
295
|
+
20069 景德镇
|
|
296
|
+
20067 九江
|
|
297
|
+
20072 南昌
|
|
298
|
+
20071 萍乡
|
|
299
|
+
20074 上饶
|
|
300
|
+
20073 新余
|
|
301
|
+
20075 宜春
|
|
302
|
+
20076 鹰潭
|
|
303
|
+
21151 鞍山
|
|
304
|
+
21145 本溪
|
|
305
|
+
21147 朝阳
|
|
306
|
+
21155 大连
|
|
307
|
+
21144 丹东
|
|
308
|
+
21152 抚顺
|
|
309
|
+
21150 阜新
|
|
310
|
+
21157 葫芦岛
|
|
311
|
+
21146 锦州
|
|
312
|
+
21148 辽阳
|
|
313
|
+
21149 盘锦
|
|
314
|
+
21153 沈阳
|
|
315
|
+
21154 铁岭
|
|
316
|
+
21156 营口
|
|
317
|
+
22159 阿拉善盟
|
|
318
|
+
22162 巴彦淖尔
|
|
319
|
+
22169 包头
|
|
320
|
+
22158 赤峰
|
|
321
|
+
22168 鄂尔多斯
|
|
322
|
+
22167 呼和浩特
|
|
323
|
+
22166 呼伦贝尔
|
|
324
|
+
22161 通辽
|
|
325
|
+
22164 乌海
|
|
326
|
+
22163 乌兰察布
|
|
327
|
+
22165 锡林郭勒盟
|
|
328
|
+
22160 兴安盟
|
|
329
|
+
23170 固原
|
|
330
|
+
23171 石嘴山
|
|
331
|
+
23172 吴忠
|
|
332
|
+
23174 银川
|
|
333
|
+
23173 中卫
|
|
334
|
+
24496 果洛
|
|
335
|
+
24494 海北
|
|
336
|
+
24176 海东
|
|
337
|
+
24479 海南
|
|
338
|
+
24177 海西
|
|
339
|
+
24495 黄南
|
|
340
|
+
24175 西宁
|
|
341
|
+
24178 玉树
|
|
342
|
+
25223 滨州
|
|
343
|
+
25200 德州
|
|
344
|
+
25220 东营
|
|
345
|
+
25222 菏泽
|
|
346
|
+
25196 济南
|
|
347
|
+
25197 济宁
|
|
348
|
+
25198 莱芜
|
|
349
|
+
25199 聊城
|
|
350
|
+
25201 临沂
|
|
351
|
+
25202 青岛
|
|
352
|
+
25203 日照
|
|
353
|
+
25208 泰安
|
|
354
|
+
25218 威海
|
|
355
|
+
25204 潍坊
|
|
356
|
+
25219 烟台
|
|
357
|
+
25221 枣庄
|
|
358
|
+
25207 淄博
|
|
359
|
+
26217 大同
|
|
360
|
+
26205 晋城
|
|
361
|
+
26206 晋中
|
|
362
|
+
26211 临汾
|
|
363
|
+
26210 吕梁
|
|
364
|
+
26213 朔州
|
|
365
|
+
26214 太原
|
|
366
|
+
26212 忻州
|
|
367
|
+
26215 阳泉
|
|
368
|
+
26216 运城
|
|
369
|
+
26209 长治
|
|
370
|
+
27240 安康
|
|
371
|
+
27239 宝鸡
|
|
372
|
+
27248 汉中
|
|
373
|
+
27241 商洛
|
|
374
|
+
27242 铜川
|
|
375
|
+
27243 渭南
|
|
376
|
+
27244 西安
|
|
377
|
+
27245 咸阳
|
|
378
|
+
27246 延安
|
|
379
|
+
27249 榆林
|
|
380
|
+
28252 阿坝
|
|
381
|
+
28247 巴中
|
|
382
|
+
28226 成都
|
|
383
|
+
28250 达州
|
|
384
|
+
28232 德阳
|
|
385
|
+
28236 甘孜
|
|
386
|
+
28224 广安
|
|
387
|
+
28225 广元
|
|
388
|
+
28233 乐山
|
|
389
|
+
28228 凉山
|
|
390
|
+
28234 泸州
|
|
391
|
+
28227 眉山
|
|
392
|
+
28229 绵阳
|
|
393
|
+
28231 南充
|
|
394
|
+
28235 内江
|
|
395
|
+
28230 攀枝花
|
|
396
|
+
28237 遂宁
|
|
397
|
+
28251 雅安
|
|
398
|
+
28254 宜宾
|
|
399
|
+
28238 资阳
|
|
400
|
+
28253 自贡
|
|
401
|
+
29498 阿里
|
|
402
|
+
29480 昌都
|
|
403
|
+
29269 拉萨
|
|
404
|
+
29270 林芝
|
|
405
|
+
29268 那曲
|
|
406
|
+
29271 日喀则
|
|
407
|
+
29497 山南
|
|
408
|
+
30185 阿克苏
|
|
409
|
+
30499 阿拉尔
|
|
410
|
+
30182 阿勒泰
|
|
411
|
+
30191 巴音郭楞
|
|
412
|
+
30180 博尔塔拉
|
|
413
|
+
30181 昌吉
|
|
414
|
+
30179 哈密
|
|
415
|
+
30195 和田
|
|
416
|
+
30183 喀什
|
|
417
|
+
30184 克拉玛依
|
|
418
|
+
30186 克孜勒苏柯尔克孜
|
|
419
|
+
30187 石河子
|
|
420
|
+
30188 塔城
|
|
421
|
+
30500 图木舒克
|
|
422
|
+
30190 吐鲁番
|
|
423
|
+
30192 乌鲁木齐
|
|
424
|
+
30189 五家渠
|
|
425
|
+
30193 伊犁
|
|
426
|
+
31289 保山
|
|
427
|
+
31283 楚雄
|
|
428
|
+
31292 大理
|
|
429
|
+
31286 德宏
|
|
430
|
+
31482 迪庆
|
|
431
|
+
31293 红河
|
|
432
|
+
31284 昆明
|
|
433
|
+
31285 丽江
|
|
434
|
+
31287 临沧
|
|
435
|
+
31481 怒江
|
|
436
|
+
31290 普洱
|
|
437
|
+
31288 曲靖
|
|
438
|
+
31291 文山
|
|
439
|
+
31483 西双版纳
|
|
440
|
+
31295 玉溪
|
|
441
|
+
31294 昭通
|
|
442
|
+
32280 杭州
|
|
443
|
+
32282 湖州
|
|
444
|
+
32273 嘉兴
|
|
445
|
+
32272 金华
|
|
446
|
+
32275 丽水
|
|
447
|
+
32276 宁波
|
|
448
|
+
32274 衢州
|
|
449
|
+
32277 绍兴
|
|
450
|
+
32279 台州
|
|
451
|
+
32278 温州
|
|
452
|
+
32281 舟山
|
|
495
453
|
```
|
|
496
454
|
|
|
497
455
|
####错误代码
|
data/lib/baidu/sem/rank.rb
CHANGED
data/lib/baidu/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: baidu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- seoaqua
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -96,10 +96,6 @@ files:
|
|
|
96
96
|
- docs/BaiduSEMAPI_V3.pdf
|
|
97
97
|
- lib/baidu.rb
|
|
98
98
|
- lib/baidu/auth.rb
|
|
99
|
-
- lib/baidu/map.rb
|
|
100
|
-
- lib/baidu/map/geocoder.rb
|
|
101
|
-
- lib/baidu/map/request.rb
|
|
102
|
-
- lib/baidu/map/result.rb
|
|
103
99
|
- lib/baidu/response.rb
|
|
104
100
|
- lib/baidu/sem.rb
|
|
105
101
|
- lib/baidu/sem/account.rb
|
|
@@ -113,13 +109,11 @@ files:
|
|
|
113
109
|
- lib/baidu/sem/kr.rb
|
|
114
110
|
- lib/baidu/sem/new_creative.rb
|
|
115
111
|
- lib/baidu/sem/rank.rb
|
|
116
|
-
- lib/baidu/sem/rankservice.rb
|
|
117
112
|
- lib/baidu/sem/report.rb
|
|
118
113
|
- lib/baidu/sem/search.rb
|
|
119
114
|
- lib/baidu/translate.rb
|
|
120
115
|
- lib/baidu/version.rb
|
|
121
116
|
- lib/ext.rb
|
|
122
|
-
- spec/map_spec.rb
|
|
123
117
|
- spec/sem_account_spec.rb
|
|
124
118
|
- spec/sem_adgroup_spec.rb
|
|
125
119
|
- spec/sem_api_response_spec.rb
|
|
@@ -156,7 +150,6 @@ signing_key:
|
|
|
156
150
|
specification_version: 4
|
|
157
151
|
summary: a gem summary
|
|
158
152
|
test_files:
|
|
159
|
-
- spec/map_spec.rb
|
|
160
153
|
- spec/sem_account_spec.rb
|
|
161
154
|
- spec/sem_adgroup_spec.rb
|
|
162
155
|
- spec/sem_api_response_spec.rb
|
data/lib/baidu/map.rb
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
require 'httparty'
|
|
2
|
-
module Baidu
|
|
3
|
-
module Map
|
|
4
|
-
class Place
|
|
5
|
-
include HTTParty
|
|
6
|
-
HOST = 'api.map.baidu.com'
|
|
7
|
-
@service_path = '/place/v2'
|
|
8
|
-
def initialize(ak,pagesize=10,page_num=0,scope=2)
|
|
9
|
-
@ak = ak
|
|
10
|
-
@segments = {:ak=>@ak,:output=>'json',:pagesize=>pagesize,:page_num => page_num,:scope=>scope}
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def search(query,region)
|
|
14
|
-
action_path = File.join(@service_path,__method__)
|
|
15
|
-
@http_segments = @segments.clone
|
|
16
|
-
@http_segments['query'] = query
|
|
17
|
-
@http_segments['region'] = region
|
|
18
|
-
uri = URI::HTTP.build(
|
|
19
|
-
:host => HOST,
|
|
20
|
-
:path => action_path,
|
|
21
|
-
:query => make_query(@http_segments)
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
self.class.get(uri)
|
|
25
|
-
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def detail
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def eventsearch
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def eventdetail
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def bus
|
|
38
|
-
@segments[:query]='公交站'
|
|
39
|
-
self
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def bank
|
|
43
|
-
@segments[:query]='银行'
|
|
44
|
-
self
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def cafe
|
|
48
|
-
@segments[:query]='餐馆'
|
|
49
|
-
self
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def spot
|
|
53
|
-
@segments[:query]='景点'
|
|
54
|
-
self
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def around(lat,lng)
|
|
58
|
-
@segments[:location] = "#{lat},#{lng}"
|
|
59
|
-
self
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def within(radius)
|
|
63
|
-
@segments[:radius] = radius
|
|
64
|
-
self
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
#得到百度地图城市id
|
|
68
|
-
def self.get_cityid(cityname)
|
|
69
|
-
body = get "http://api.map.baidu.com/?qt=cur&wd=#{URI.encode(cityname)}&ie=utf-8&res=api"
|
|
70
|
-
return body['content']['code']
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
#从每条结果中解析x,y坐标
|
|
74
|
-
def self.coordinate(poiname,cityid)
|
|
75
|
-
# puts "http://api.map.baidu.com/geocoder?address=#{URI.encode(poiname)}&output=json&ak=#{@ak}&city=#{URI.encode(cityid)}"
|
|
76
|
-
url = "http://api.map.baidu.com/geocoder/v2?address=#{URI.encode(poiname)}&output=json&ak=#{@ak}&city=#{cityid}"
|
|
77
|
-
result = get url
|
|
78
|
-
location = result['result']
|
|
79
|
-
return nil if location.nil? or location.empty?
|
|
80
|
-
location = location['location']
|
|
81
|
-
return location['lng'],location['lat'] if result['status'] == 'OK'
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def info
|
|
85
|
-
uri = URI::HTTP.build(
|
|
86
|
-
:host => 'api.map.baidu.com',
|
|
87
|
-
:query=> URI.encode(@segments.map{|k,v|"#{k}=#{v}"}.join('&')),
|
|
88
|
-
:path => '/place/v2/search'
|
|
89
|
-
)
|
|
90
|
-
self.class.get(uri.to_s)
|
|
91
|
-
end
|
|
92
|
-
private
|
|
93
|
-
def make_query(segments)
|
|
94
|
-
URI.encode(segments.map{|k,v|"#{k}=#{v}"}.join('&'))
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|
data/lib/baidu/map/geocoder.rb
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
module Baidu
|
|
2
|
-
module Map
|
|
3
|
-
class Geocoder
|
|
4
|
-
include HTTParty
|
|
5
|
-
HOST = 'api.map.baidu.com'
|
|
6
|
-
PATH = '/geocoder/v2/'
|
|
7
|
-
def initialize(ak)
|
|
8
|
-
@ak = ak
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def encode(address,city)
|
|
12
|
-
segments = {
|
|
13
|
-
'ak'=>@ak,
|
|
14
|
-
'address' => address,
|
|
15
|
-
'city' => city,
|
|
16
|
-
'output'=>'json'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
uri = URI::HTTP.build(
|
|
20
|
-
:host => @host,
|
|
21
|
-
:path => @path
|
|
22
|
-
:query => make_query(segments)
|
|
23
|
-
).to_s
|
|
24
|
-
self.class.get(uri)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def decodoe(lng,lat)
|
|
28
|
-
segments = {
|
|
29
|
-
'ak'=>@ak,
|
|
30
|
-
'location'=>"#{lng},#{lat}",
|
|
31
|
-
'output'=>'json'
|
|
32
|
-
}
|
|
33
|
-
uri = URI::HTTP.build(
|
|
34
|
-
:host =>
|
|
35
|
-
:query=> make_query(segments)
|
|
36
|
-
:path => PATH
|
|
37
|
-
).to_s
|
|
38
|
-
self.class.get(uri)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
def make_query(segments)
|
|
43
|
-
URI.encode(segments.map{|k,v|"#{k}=#{v}"}.join('&')),
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
data/lib/baidu/map/request.rb
DELETED
data/lib/baidu/map/result.rb
DELETED
data/spec/map_spec.rb
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
#coding:UTF-8
|
|
2
|
-
require 'spec_helper'
|
|
3
|
-
|
|
4
|
-
describe Baidu::Map do
|
|
5
|
-
subject {Baidu::Map}
|
|
6
|
-
describe "#get_cityid" do
|
|
7
|
-
it "查询北京应返回131" do
|
|
8
|
-
subject.get_cityid('北京').should == 131
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#coordinate" do
|
|
13
|
-
it "抓取北京医院信息,应返回正确经纬度数组" do
|
|
14
|
-
xy = subject.coordinate('北京医院',131)
|
|
15
|
-
xy.class.should == Array
|
|
16
|
-
# xy.each do |number|
|
|
17
|
-
# number.to_f.should > 0
|
|
18
|
-
# end
|
|
19
|
-
# xy.should == [116.421477, 39.910057]
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe Baidu::Map do
|
|
25
|
-
subject{Baidu::Map.new(BAIDU_MAP_KEY)}
|
|
26
|
-
let(:poi){subject.around(39.811031821584, 116.44931548023).within(1000)}
|
|
27
|
-
describe '#cafe' do
|
|
28
|
-
it "should return self when calling #cafe" do
|
|
29
|
-
subject.cafe.is_a? Baidu::Map
|
|
30
|
-
subject.bus.is_a? Baidu::Map
|
|
31
|
-
subject.bank.is_a? Baidu::Map
|
|
32
|
-
subject.spot.is_a? Baidu::Map
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
describe "#bus" do
|
|
37
|
-
it "抓取公交信息" do
|
|
38
|
-
# poi = subject.around(39.811031821584, 116.44931548023).within(1000)
|
|
39
|
-
bus = poi.bus.info
|
|
40
|
-
bus.class.should == HTTParty::Response
|
|
41
|
-
status = bus['status']
|
|
42
|
-
results = bus['results']
|
|
43
|
-
status.should == 0
|
|
44
|
-
results.class.should == Array
|
|
45
|
-
results.first.class.should == Hash
|
|
46
|
-
results.first['name'].should_not == nil
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
describe "#bank" do
|
|
51
|
-
it "抓取银行信息" do
|
|
52
|
-
# poi = subject.around(39.811031821584, 116.44931548023).within(1000)
|
|
53
|
-
bank = poi.bank.info
|
|
54
|
-
bank.class.should == HTTParty::Response
|
|
55
|
-
status = bank['status']
|
|
56
|
-
results = bank['results']
|
|
57
|
-
status.should == 0
|
|
58
|
-
results.class.should == Array
|
|
59
|
-
results.first.class.should == Hash
|
|
60
|
-
results.first['name'].should_not == nil
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
describe "#cafe" do
|
|
65
|
-
it "抓取餐馆信息" do
|
|
66
|
-
# poi = subject.around(39.811031821584, 116.44931548023).within(1000)
|
|
67
|
-
cafe = poi.cafe.info
|
|
68
|
-
cafe.class.should == HTTParty::Response
|
|
69
|
-
status = cafe['status']
|
|
70
|
-
results = cafe['results']
|
|
71
|
-
status.should == 0
|
|
72
|
-
results.class.should == Array
|
|
73
|
-
results.first.class.should == Hash
|
|
74
|
-
results.first['name'].should_not == nil
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|