keybase-proofs 2.3.25 → 2.3.28

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.3.28 (2024-07-19)
2
+
3
+ - Use version 2 API for X (formerly known as Twitter) hunting.
4
+
5
+ ## 2.3.27 (2024-07-18)
6
+
7
+ - Fix error handling when an invalid unicode domain is passed to DnsScraper.
8
+
9
+ ## 2.3.26 (2024-06-17)
10
+
11
+ - Use oauth API for reddit scraping.
12
+
1
13
  ## 2.3.24 (2020-12-23)
2
14
 
3
15
  - Use oembed API for twitter scraping.
package/lib/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- // Generated by IcedCoffeeScript 108.0.12
1
+ // Generated by IcedCoffeeScript 108.0.11
2
2
  (function() {
3
3
  var constants, d, k, v, _ref;
4
4
 
@@ -172,6 +172,7 @@
172
172
  HTTP_400: 240,
173
173
  HTTP_OTHER: 260,
174
174
  EMPTY_JSON: 270,
175
+ INVALID_JSON: 271,
175
176
  DELETED: 301,
176
177
  SERVICE_DEAD: 302,
177
178
  BAD_SIGNATURE: 303
@@ -1,6 +1,6 @@
1
- // Generated by IcedCoffeeScript 108.0.12
1
+ // Generated by IcedCoffeeScript 108.0.11
2
2
  (function() {
3
- var BaseScraper, b64find, callbackify, constants, decode_sig, iced, parse_int_or_undefined, pkg, sncmp, space_normalize, urlmod, user_agent, v_codes, __iced_k, __iced_k_noop;
3
+ var BaseBearerToken, BaseScraper, Lock, b64find, callbackify, constants, decode_sig, iced, parse_int_or_undefined, pkg, sncmp, space_normalize, urlmod, user_agent, v_codes, __iced_k, __iced_k_noop;
4
4
 
5
5
  iced = require('iced-runtime');
6
6
  __iced_k = __iced_k_noop = function() {};
@@ -21,6 +21,8 @@
21
21
 
22
22
  callbackify = require('util').callbackify;
23
23
 
24
+ Lock = require('../util').Lock;
25
+
24
26
  exports.user_agent = user_agent = constants.user_agent + pkg.version;
25
27
 
26
28
  BaseScraper = (function() {
@@ -94,7 +96,7 @@
94
96
  (function(__iced_k) {
95
97
  __iced_deferrals = new iced.Deferrals(__iced_k, {
96
98
  parent: ___iced_passed_deferral,
97
- filename: "/home/zapu/Projects/KB/proofs/src/scrapers/base.iced",
99
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/base.iced",
98
100
  funcname: "BaseScraper.validate"
99
101
  });
100
102
  _this.check_status(args, __iced_deferrals.defer({
@@ -104,7 +106,7 @@
104
106
  return rc = arguments[1];
105
107
  };
106
108
  })(),
107
- lineno: 53
109
+ lineno: 54
108
110
  }));
109
111
  __iced_deferrals._fulfill();
110
112
  })(__iced_k);
@@ -141,6 +143,15 @@
141
143
  return b64find(raw, ptc_buf);
142
144
  };
143
145
 
146
+ BaseScraper.prototype._get_rate_limit_header = function(headers, name) {
147
+ var v;
148
+ if ((v = parse_int_or_undefined(headers.get("X-RateLimit-" + name))) || (v = parse_int_or_undefined(headers.get("X-Rate-Limit-" + name)))) {
149
+ return v;
150
+ } else {
151
+ return void 0;
152
+ }
153
+ };
154
+
144
155
  BaseScraper.prototype._get_url_body = function(opts, cb) {
145
156
  var body, err, f, rc, response, rl_limit, rl_remaining, rl_reset, ___iced_passed_deferral, __iced_deferrals, __iced_k, _base;
146
157
  __iced_k = __iced_k_noop;
@@ -160,7 +171,7 @@
160
171
  return (function(__iced_k) {
161
172
  __iced_deferrals = new iced.Deferrals(__iced_k, {
162
173
  parent: ___iced_passed_deferral,
163
- filename: "/home/zapu/Projects/KB/proofs/src/scrapers/base.iced",
174
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/base.iced",
164
175
  funcname: "BaseScraper._get_url_body"
165
176
  });
166
177
  _this.libs.fetch(opts.url, opts, __iced_deferrals.defer({
@@ -170,7 +181,7 @@
170
181
  return response = arguments[1];
171
182
  };
172
183
  })(),
173
- lineno: 87
184
+ lineno: 96
174
185
  }));
175
186
  __iced_deferrals._fulfill();
176
187
  });
@@ -178,9 +189,9 @@
178
189
  return function() {
179
190
  var _base1, _ref;
180
191
  if (opts.log_ratelimit && (typeof response !== "undefined" && response !== null)) {
181
- rl_limit = parse_int_or_undefined(response.headers.get('X-RateLimit-Limit'));
182
- rl_remaining = parse_int_or_undefined(response.headers.get('X-RateLimit-Remaining'));
183
- rl_reset = parse_int_or_undefined(response.headers.get('X-RateLimit-Reset'));
192
+ rl_limit = _this._get_rate_limit_header(response.headers, 'Limit');
193
+ rl_remaining = _this._get_rate_limit_header(response.headers, 'Remaining');
194
+ rl_reset = _this._get_rate_limit_header(response.headers, 'Reset');
184
195
  if (rl_limit != null) {
185
196
  _this.log("| ratelimit info limit=" + rl_limit + " remaining=" + rl_remaining + " reset=" + rl_reset);
186
197
  }
@@ -188,7 +199,8 @@
188
199
  _base1.ratelimit_inform({
189
200
  limit: rl_limit,
190
201
  remaining: rl_remaining,
191
- reset: rl_reset
202
+ reset: rl_reset,
203
+ endpoint_name: opts.endpoint_name
192
204
  });
193
205
  }
194
206
  }
@@ -201,7 +213,7 @@
201
213
  (function(__iced_k) {
202
214
  __iced_deferrals = new iced.Deferrals(__iced_k, {
203
215
  parent: ___iced_passed_deferral,
204
- filename: "/home/zapu/Projects/KB/proofs/src/scrapers/base.iced",
216
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/base.iced",
205
217
  funcname: "BaseScraper._get_url_body"
206
218
  });
207
219
  f.call(response, __iced_deferrals.defer({
@@ -211,7 +223,7 @@
211
223
  return body = arguments[1];
212
224
  };
213
225
  })(),
214
- lineno: 109
226
+ lineno: 122
215
227
  }));
216
228
  __iced_deferrals._fulfill();
217
229
  })(function() {
@@ -244,6 +256,122 @@
244
256
 
245
257
  exports.BaseScraper = BaseScraper;
246
258
 
259
+ exports.BaseBearerToken = BaseBearerToken = (function() {
260
+ function BaseBearerToken(_arg) {
261
+ this.name = _arg.name, this.base = _arg.base, this.access_token_url = _arg.access_token_url, this.scope = _arg.scope, this.user_agent = _arg.user_agent;
262
+ if (this.access_token_url == null) {
263
+ throw new Error("@access_token_url is required");
264
+ }
265
+ if ((this.scope != null) && !Array.isArray(this.scope)) {
266
+ throw new Error("@scope has to be an array if present");
267
+ }
268
+ this._tok = null;
269
+ this._created = 0;
270
+ this._lock = new Lock();
271
+ this.auth = this.base.auth;
272
+ }
273
+
274
+ BaseBearerToken.prototype.get = function(cb) {
275
+ var body, cred, e, err, now, opts, rc, req, res, tok, ___iced_passed_deferral, __iced_deferrals, __iced_k;
276
+ __iced_k = __iced_k_noop;
277
+ ___iced_passed_deferral = iced.findDeferral(arguments);
278
+ (function(_this) {
279
+ return (function(__iced_k) {
280
+ __iced_deferrals = new iced.Deferrals(__iced_k, {
281
+ parent: ___iced_passed_deferral,
282
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/base.iced",
283
+ funcname: "BaseBearerToken.get"
284
+ });
285
+ _this._lock.acquire(__iced_deferrals.defer({
286
+ lineno: 160
287
+ }));
288
+ __iced_deferrals._fulfill();
289
+ });
290
+ })(this)((function(_this) {
291
+ return function() {
292
+ err = null;
293
+ now = Math.floor(Date.now() / 1000);
294
+ (function(__iced_k) {
295
+ if (((res = _this._tok) == null) || (now - _this._created > _this.auth.lifespan)) {
296
+ _this.base.log("+ Request for bearer token");
297
+ cred = (Buffer.from([_this.auth.key, _this.auth.secret].join(":"))).toString('base64');
298
+ req = 'grant_type=client_credentials';
299
+ if (_this.scope) {
300
+ req += "&scope=" + (encodeURIComponent(_this.scope.join(' ')));
301
+ }
302
+ opts = {
303
+ url: _this.access_token_url,
304
+ headers: {
305
+ Authorization: "Basic " + cred,
306
+ 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
307
+ 'Content-Length': req.length
308
+ },
309
+ method: "post",
310
+ body: req
311
+ };
312
+ if (_this.user_agent) {
313
+ opts.user_agent = _this.user_agent;
314
+ }
315
+ (function(__iced_k) {
316
+ __iced_deferrals = new iced.Deferrals(__iced_k, {
317
+ parent: ___iced_passed_deferral,
318
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/base.iced",
319
+ funcname: "BaseBearerToken.get"
320
+ });
321
+ _this.base._get_url_body(opts, __iced_deferrals.defer({
322
+ assign_fn: (function() {
323
+ return function() {
324
+ err = arguments[0];
325
+ rc = arguments[1];
326
+ return body = arguments[2];
327
+ };
328
+ })(),
329
+ lineno: 185
330
+ }));
331
+ __iced_deferrals._fulfill();
332
+ })(function() {
333
+ if (err != null) {
334
+ _this.base.logl('error', "In getting bearer_token: " + err.message);
335
+ } else if (rc !== v_codes.OK) {
336
+ _this.base.logl('error', "error in getting bearer token: " + rc);
337
+ err = new Error("error: " + rc);
338
+ } else {
339
+ try {
340
+ body = JSON.parse(body);
341
+ } catch (_error) {
342
+ e = _error;
343
+ _this.base.logl('warn', "Could not parse JSON reply: " + e);
344
+ err = e;
345
+ }
346
+ }
347
+ if (err != null) {
348
+
349
+ } else if ((tok = body.access_token) == null) {
350
+ _this.base.logl('warn', "No access token found in reply");
351
+ err = new Error("" + _this.name + " error: no access token");
352
+ } else {
353
+ _this._tok = tok;
354
+ _this._created = Math.floor(Date.now() / 1000);
355
+ res = _this._tok;
356
+ }
357
+ _this.base.log("- Request for bearer token for " + _this.name + " -> err: " + err);
358
+ return __iced_k(!err ? _this.base.log("Bearer token for " + _this.name + " is: " + (res != null ? res.substr(0, 5) : void 0) + "...") : void 0);
359
+ });
360
+ } else {
361
+ return __iced_k();
362
+ }
363
+ })(function() {
364
+ _this._lock.release();
365
+ return cb(err, res);
366
+ });
367
+ };
368
+ })(this));
369
+ };
370
+
371
+ return BaseBearerToken;
372
+
373
+ })();
374
+
247
375
  parse_int_or_undefined = function(value) {
248
376
  var out;
249
377
  if ((out = Number(value)) === parseInt(value) && !isNaN(out)) {
@@ -151,7 +151,7 @@
151
151
  (function(__iced_k) {
152
152
  __iced_deferrals = new iced.Deferrals(__iced_k, {
153
153
  parent: ___iced_passed_deferral,
154
- filename: "/Users/max/src/keybase/proofs/src/scrapers/dns.iced",
154
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/dns.iced",
155
155
  funcname: "DnsScraper.check_status"
156
156
  });
157
157
  _this._check_status({
@@ -191,28 +191,40 @@ _break()
191
191
  })(this));
192
192
  };
193
193
 
194
+ DnsScraper.prototype._resolve_txt = function(domain, cb) {
195
+ var dnslib, err;
196
+ dnslib = this.libs.dns || dns;
197
+ try {
198
+ return dnslib.resolveTxt(domain, function(err, records) {
199
+ return cb(err, records);
200
+ });
201
+ } catch (_error) {
202
+ err = _error;
203
+ return cb(err);
204
+ }
205
+ };
206
+
194
207
  DnsScraper.prototype._check_status = function(_arg, cb) {
195
- var dnslib, domain, err, proof_text_check, rc, records, ___iced_passed_deferral, __iced_deferrals, __iced_k;
208
+ var domain, err, proof_text_check, rc, records, ___iced_passed_deferral, __iced_deferrals, __iced_k;
196
209
  __iced_k = __iced_k_noop;
197
210
  ___iced_passed_deferral = iced.findDeferral(arguments);
198
211
  domain = _arg.domain, proof_text_check = _arg.proof_text_check;
199
212
  this.log("+ DNS check for " + domain);
200
- dnslib = this.libs.dns || dns;
201
213
  (function(_this) {
202
214
  return (function(__iced_k) {
203
215
  __iced_deferrals = new iced.Deferrals(__iced_k, {
204
216
  parent: ___iced_passed_deferral,
205
- filename: "/Users/max/src/keybase/proofs/src/scrapers/dns.iced",
217
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/dns.iced",
206
218
  funcname: "DnsScraper._check_status"
207
219
  });
208
- dnslib.resolveTxt(domain, __iced_deferrals.defer({
220
+ _this._resolve_txt(domain, __iced_deferrals.defer({
209
221
  assign_fn: (function() {
210
222
  return function() {
211
223
  err = arguments[0];
212
224
  return records = arguments[1];
213
225
  };
214
226
  })(),
215
- lineno: 105
227
+ lineno: 115
216
228
  }));
217
229
  __iced_deferrals._fulfill();
218
230
  });
@@ -1,13 +1,13 @@
1
1
  // Generated by IcedCoffeeScript 108.0.11
2
2
  (function() {
3
- var BaseScraper, PREFIX, RedditScraper, SUBREDDIT, constants, iced, proof_text_check_to_med_id, sncmp, v_codes, __iced_k, __iced_k_noop, _ref,
3
+ var BaseBearerToken, BaseScraper, OAUTH_REDDIT_URL, PREFIX, REDDIT_USER_AGENT, RedditBearerToken, RedditScraper, SUBREDDIT, bearer_token, constants, iced, inspect, proof_text_check_to_med_id, sncmp, urlmod, user_agent, v_codes, __iced_k, __iced_k_noop, _bearer_token, _ref,
4
4
  __hasProp = {}.hasOwnProperty,
5
5
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
6
6
 
7
7
  iced = require('iced-runtime');
8
8
  __iced_k = __iced_k_noop = function() {};
9
9
 
10
- _ref = require('./base'), sncmp = _ref.sncmp, BaseScraper = _ref.BaseScraper;
10
+ _ref = require('./base'), sncmp = _ref.sncmp, user_agent = _ref.user_agent, BaseScraper = _ref.BaseScraper, BaseBearerToken = _ref.BaseBearerToken;
11
11
 
12
12
  constants = require('../constants').constants;
13
13
 
@@ -15,14 +15,54 @@
15
15
 
16
16
  proof_text_check_to_med_id = require('../base').proof_text_check_to_med_id;
17
17
 
18
+ urlmod = require('url');
19
+
20
+ inspect = require('util').inspect;
21
+
18
22
  PREFIX = "https://www.reddit.com";
19
23
 
20
24
  SUBREDDIT = PREFIX + "/r/keybaseproofs";
21
25
 
26
+ OAUTH_REDDIT_URL = "https://oauth.reddit.com";
27
+
28
+ REDDIT_USER_AGENT = user_agent + " (by /u/maxtaco)";
29
+
30
+ RedditBearerToken = (function(_super) {
31
+ __extends(RedditBearerToken, _super);
32
+
33
+ function RedditBearerToken(_arg) {
34
+ this.base = _arg.base;
35
+ RedditBearerToken.__super__.constructor.call(this, {
36
+ name: "Reddit",
37
+ base: this.base,
38
+ access_token_url: "" + OAUTH_REDDIT_URL + "/api/v1/access_token",
39
+ scope: ['history', 'read'],
40
+ user_agent: REDDIT_USER_AGENT
41
+ });
42
+ }
43
+
44
+ return RedditBearerToken;
45
+
46
+ })(BaseBearerToken);
47
+
48
+ _bearer_token = null;
49
+
50
+ bearer_token = function(_arg) {
51
+ var base;
52
+ base = _arg.base;
53
+ if (!_bearer_token) {
54
+ _bearer_token = new RedditBearerToken({
55
+ base: base
56
+ });
57
+ }
58
+ return _bearer_token;
59
+ };
60
+
22
61
  exports.RedditScraper = RedditScraper = (function(_super) {
23
62
  __extends(RedditScraper, _super);
24
63
 
25
64
  function RedditScraper(opts) {
65
+ this.auth = opts.auth;
26
66
  RedditScraper.__super__.constructor.call(this, opts);
27
67
  }
28
68
 
@@ -60,11 +100,11 @@
60
100
  return (function(__iced_k) {
61
101
  __iced_deferrals = new iced.Deferrals(__iced_k, {
62
102
  parent: ___iced_passed_deferral,
63
- filename: "/Users/max/src/keybase/proofs/src/scrapers/reddit.iced",
103
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/reddit.iced",
64
104
  funcname: "RedditScraper.hunt2"
65
105
  });
66
- _this._get_url_body({
67
- url: "" + PREFIX + "/user/" + (encodeURIComponent(username)) + "/submitted.json?count=25&cachebust=" + (Math.random()),
106
+ _this._get_body_api({
107
+ url: "" + OAUTH_REDDIT_URL + "/user/" + (encodeURIComponent(username)) + "/submitted.json?count=25&cachebust=" + (Math.random()),
68
108
  json: true
69
109
  }, __iced_deferrals.defer({
70
110
  assign_fn: (function() {
@@ -74,7 +114,7 @@
74
114
  return json = arguments[2];
75
115
  };
76
116
  })(),
77
- lineno: 43
117
+ lineno: 69
78
118
  }));
79
119
  __iced_deferrals._fulfill();
80
120
  });
@@ -169,21 +209,32 @@
169
209
  };
170
210
 
171
211
  RedditScraper.prototype.check_status = function(_arg, cb) {
172
- var api_url, err, json, post, proof_text_check, rc, remote_id, username, ___iced_passed_deferral, __iced_deferrals, __iced_k;
212
+ var api_url, err, json, post, proof_text_check, rc, remote_id, u, username, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref1;
173
213
  __iced_k = __iced_k_noop;
174
214
  ___iced_passed_deferral = iced.findDeferral(arguments);
175
215
  username = _arg.username, api_url = _arg.api_url, proof_text_check = _arg.proof_text_check, remote_id = _arg.remote_id;
216
+ u = urlmod.parse(api_url);
217
+ if (!u) {
218
+ return cb(new Error("Failed to parse api_url"));
219
+ }
220
+ if ((_ref1 = u.host) !== 'www.reddit.com' && _ref1 !== 'oauth.reddit.com') {
221
+ return cb(new Error("Unexpected api_url host: " + host));
222
+ }
223
+ u = urlmod.format({
224
+ host: 'oauth.reddit.com',
225
+ protocol: 'https:',
226
+ pathname: u.pathname
227
+ });
176
228
  (function(_this) {
177
229
  return (function(__iced_k) {
178
230
  __iced_deferrals = new iced.Deferrals(__iced_k, {
179
231
  parent: ___iced_passed_deferral,
180
- filename: "/Users/max/src/keybase/proofs/src/scrapers/reddit.iced",
232
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/reddit.iced",
181
233
  funcname: "RedditScraper.check_status"
182
234
  });
183
- _this._get_url_body({
184
- url: api_url + ("?cachebust=" + (Math.random())),
185
- json: true,
186
- user_agent: "linux:com.github/keybase/proofs:v2.1.41 (by /u/maxtaco)"
235
+ _this._get_body_api({
236
+ url: u,
237
+ json: true
187
238
  }, __iced_deferrals.defer({
188
239
  assign_fn: (function() {
189
240
  return function() {
@@ -192,7 +243,7 @@
192
243
  return json = arguments[2];
193
244
  };
194
245
  })(),
195
- lineno: 117
246
+ lineno: 158
196
247
  }));
197
248
  __iced_deferrals._fulfill();
198
249
  });
@@ -208,6 +259,110 @@
208
259
  })(this));
209
260
  };
210
261
 
262
+ RedditScraper.prototype._get_bearer_token = function(cb) {
263
+ var bt, err, rc, tok, ___iced_passed_deferral, __iced_deferrals, __iced_k;
264
+ __iced_k = __iced_k_noop;
265
+ ___iced_passed_deferral = iced.findDeferral(arguments);
266
+ bt = bearer_token({
267
+ base: this
268
+ });
269
+ (function(_this) {
270
+ return (function(__iced_k) {
271
+ __iced_deferrals = new iced.Deferrals(__iced_k, {
272
+ parent: ___iced_passed_deferral,
273
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/reddit.iced",
274
+ funcname: "RedditScraper._get_bearer_token"
275
+ });
276
+ bt.get(__iced_deferrals.defer({
277
+ assign_fn: (function() {
278
+ return function() {
279
+ err = arguments[0];
280
+ return tok = arguments[1];
281
+ };
282
+ })(),
283
+ lineno: 169
284
+ }));
285
+ __iced_deferrals._fulfill();
286
+ });
287
+ })(this)((function(_this) {
288
+ return function() {
289
+ rc = typeof err !== "undefined" && err !== null ? v_codes.AUTH_FAILED : v_codes.OK;
290
+ return cb(err, rc, tok);
291
+ };
292
+ })(this));
293
+ };
294
+
295
+ RedditScraper.prototype._get_body_api = function(_arg, cb) {
296
+ var args, body, err, json, rc, tok, url, ___iced_passed_deferral, __iced_deferrals, __iced_k;
297
+ __iced_k = __iced_k_noop;
298
+ ___iced_passed_deferral = iced.findDeferral(arguments);
299
+ url = _arg.url, json = _arg.json;
300
+ rc = body = err = null;
301
+ (function(_this) {
302
+ return (function(__iced_k) {
303
+ __iced_deferrals = new iced.Deferrals(__iced_k, {
304
+ parent: ___iced_passed_deferral,
305
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/reddit.iced",
306
+ funcname: "RedditScraper._get_body_api"
307
+ });
308
+ _this._get_bearer_token(__iced_deferrals.defer({
309
+ assign_fn: (function() {
310
+ return function() {
311
+ err = arguments[0];
312
+ rc = arguments[1];
313
+ return tok = arguments[2];
314
+ };
315
+ })(),
316
+ lineno: 177
317
+ }));
318
+ __iced_deferrals._fulfill();
319
+ });
320
+ })(this)((function(_this) {
321
+ return function() {
322
+ (function(__iced_k) {
323
+ if (err == null) {
324
+ _this.log("| HTTP API request for URL '" + url + "'");
325
+ if (json == null) {
326
+ json = true;
327
+ }
328
+ args = {
329
+ url: url,
330
+ json: json,
331
+ headers: {
332
+ Authorization: "Bearer " + tok
333
+ },
334
+ method: "get",
335
+ json: true,
336
+ user_agent: REDDIT_USER_AGENT
337
+ };
338
+ (function(__iced_k) {
339
+ __iced_deferrals = new iced.Deferrals(__iced_k, {
340
+ parent: ___iced_passed_deferral,
341
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/server_test_progs/proofs/src/scrapers/reddit.iced",
342
+ funcname: "RedditScraper._get_body_api"
343
+ });
344
+ _this._get_url_body(args, __iced_deferrals.defer({
345
+ assign_fn: (function() {
346
+ return function() {
347
+ err = arguments[0];
348
+ rc = arguments[1];
349
+ return body = arguments[2];
350
+ };
351
+ })(),
352
+ lineno: 189
353
+ }));
354
+ __iced_deferrals._fulfill();
355
+ })(__iced_k);
356
+ } else {
357
+ return __iced_k();
358
+ }
359
+ })(function() {
360
+ return cb(err, rc, body);
361
+ });
362
+ };
363
+ })(this));
364
+ };
365
+
211
366
  return RedditScraper;
212
367
 
213
368
  })(BaseScraper);