Skip to content

Commit 9636df2

Browse files
committed
Add the --noCache option to dump_wiki
Allow requests to be issued with the `Cache-Control: no-cache` header. Also update the dependencies and get rid of core-js.
1 parent 3ac4a24 commit 9636df2

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

bin/dump_wiki

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ var argParser = require('yargs')
4343
alias: 'url',
4444
default: '{{host}}/{{domain}}/v1/page/html/{title}/{oldid}'
4545
})
46+
.options('n', {
47+
alias: 'noCache',
48+
default: false
49+
})
4650
//.default('apiURL', 'http://en.wikipedia.org/w/api.php')
4751
//.default('prefix', 'en.wikipedia.org')
4852
//.default('ns', '0')

lib/htmldump.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"use strict";
2-
// Upgrade to es6
3-
require('core-js/shim');
42

53
var P = require('bluebird');
64
var Template = require('swagger-router').Template;
@@ -218,7 +216,8 @@ function makeDump (options) {
218216
uri: options.url,
219217
headers: {
220218
'user-agent': options.userAgent,
221-
'accept-encoding': 'gzip'
219+
'accept-encoding': 'gzip',
220+
'cache-control': options.noCache ? 'no-cache' : undefined
222221
},
223222
retries: 5,
224223
timeout: 60000,

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "htmldump",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Parsoid HTML dump utility",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1"
@@ -14,16 +14,15 @@
1414
"url": "github.com/wikimedia/htmldumper"
1515
},
1616
"author": "Gabriel Wicke <gwicke@wikimedia.org>",
17-
"license": "Apache2",
17+
"license": "Apache-2.0",
1818
"bugs": {
1919
"url": "https://github.com/wikimedia/htmldumper/issues"
2020
},
2121
"dependencies": {
22-
"bluebird": "~2.3.11",
23-
"core-js": "^1.0.0",
24-
"preq": "~0.3.1",
25-
"sqlite3": "^3.0.5",
26-
"swagger-router": "^0.5.6",
27-
"yargs": "~1.2.1"
22+
"bluebird": "^3.5.2",
23+
"preq": "^0.5.6",
24+
"sqlite3": "^4.0.2",
25+
"swagger-router": "^0.7.1",
26+
"yargs": "^12.0.2"
2827
}
2928
}

0 commit comments

Comments
 (0)