scrapemyferry 1.2.0 → 1.3.0
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/bin/scrapemyferry.js +0 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -15
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/sources/bcf/cookiejar.d.ts +3 -0
- package/dist/lib/sources/bcf/cookiejar.d.ts.map +1 -0
- package/dist/lib/sources/bcf/cookiejar.js +16 -0
- package/dist/lib/sources/bcf/cookiejar.js.map +1 -0
- package/dist/lib/sources/bcf/scrapeUrl.d.ts.map +1 -1
- package/dist/lib/sources/bcf/scrapeUrl.js +2 -2
- package/dist/lib/sources/bcf/scrapeUrl.js.map +1 -1
- package/dist/lib/sources/index.d.ts +1 -1
- package/dist/lib/sources/index.d.ts.map +1 -1
- package/dist/lib/sources/index.js +0 -15
- package/dist/lib/sources/index.js.map +1 -1
- package/package.json +3 -3
package/bin/scrapemyferry.js
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { sourceForType } from './lib';
|
|
2
|
+
export type { CurrentConditions, CurrentConditionsBeta, DailySchedule, DailyScheduleSailing, Departures, Routes, Sailing, SeasonalSchedule, SeasonalScheduleSailing, Source, SourceConfig, } from './lib';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,YAAY,GACb,MAAM,OAAO,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
exports.sourceForType = void 0;
|
|
4
|
+
var lib_1 = require("./lib");
|
|
5
|
+
Object.defineProperty(exports, "sourceForType", { enumerable: true, get: function () { return lib_1.sourceForType; } });
|
|
18
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAAqC;AAA5B,oGAAA,aAAa,OAAA"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import './setup';
|
|
2
|
-
export
|
|
2
|
+
export { sourceForType } from './sources';
|
|
3
|
+
export type { CurrentConditions, CurrentConditionsBeta, DailySchedule, DailyScheduleSailing, Departures, Routes, Sailing, SeasonalSchedule, SeasonalScheduleSailing, Source, SourceConfig, } from './sources';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAEhB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAEhB,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,YAAY,GACb,MAAM,WAAW,CAAA"}
|
package/dist/lib/index.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceForType = void 0;
|
|
17
4
|
require("./setup");
|
|
18
|
-
|
|
5
|
+
var sources_1 = require("./sources");
|
|
6
|
+
Object.defineProperty(exports, "sourceForType", { enumerable: true, get: function () { return sources_1.sourceForType; } });
|
|
19
7
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;AAAA,mBAAgB;AAEhB,qCAAyC;AAAhC,wGAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookiejar.d.ts","sourceRoot":"","sources":["../../../../src/lib/sources/bcf/cookiejar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,OAAO,CAAA;AAkB9D,wBAAgB,eAAe,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAGpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapWithCookies = wrapWithCookies;
|
|
4
|
+
const http_1 = require("http-cookie-agent/http");
|
|
5
|
+
function requestInterceptor(config) {
|
|
6
|
+
if (!config.jar)
|
|
7
|
+
return config;
|
|
8
|
+
config.httpAgent = new http_1.HttpCookieAgent({ cookies: { jar: config.jar } });
|
|
9
|
+
config.httpsAgent = new http_1.HttpsCookieAgent({ cookies: { jar: config.jar } });
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
function wrapWithCookies(axios) {
|
|
13
|
+
axios.interceptors.request.use(requestInterceptor);
|
|
14
|
+
return axios;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=cookiejar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookiejar.js","sourceRoot":"","sources":["../../../../src/lib/sources/bcf/cookiejar.ts"],"names":[],"mappings":";;AAkBA,0CAGC;AApBD,iDAA0E;AAU1E,SAAS,kBAAkB,CAAC,MAAgC;IAC1D,IAAI,CAAC,MAAM,CAAC,GAAG;QAAE,OAAO,MAAM,CAAA;IAC9B,MAAM,CAAC,SAAS,GAAG,IAAI,sBAAe,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACxE,MAAM,CAAC,UAAU,GAAG,IAAI,uBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC1E,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAgB,eAAe,CAA0B,KAAQ;IAC/D,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,kBAA2B,CAAC,CAAA;IAC3D,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapeUrl.d.ts","sourceRoot":"","sources":["../../../../src/lib/sources/bcf/scrapeUrl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scrapeUrl.d.ts","sourceRoot":"","sources":["../../../../src/lib/sources/bcf/scrapeUrl.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,WAAW,CAAA;AAOhC,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,wBAAsB,SAAS,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,GAAG,gBAAgB,EACpC,IAAI,EAAE,QAAQ,CAAC,aAAa,GAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CA2BnC;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,QAAQ,CAAC,aAAa,GAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAEnC"}
|
|
@@ -29,18 +29,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.scrapeUrl = scrapeUrl;
|
|
30
30
|
exports.scrapeUrlWithCookies = scrapeUrlWithCookies;
|
|
31
31
|
const axios_1 = __importDefault(require("axios"));
|
|
32
|
-
const axios_cookiejar_support_1 = require("axios-cookiejar-support");
|
|
33
32
|
const Cheerio = __importStar(require("cheerio"));
|
|
34
33
|
const scrape_it_1 = __importDefault(require("scrape-it"));
|
|
35
34
|
const tough_cookie_1 = require("tough-cookie");
|
|
36
35
|
const config_1 = require("./config");
|
|
36
|
+
const cookiejar_1 = require("./cookiejar");
|
|
37
37
|
const { headers } = config_1.config;
|
|
38
38
|
async function scrapeUrl(urlOrOpts, opts) {
|
|
39
39
|
if (typeof urlOrOpts === 'string' || !urlOrOpts.withCookies) {
|
|
40
40
|
return (0, scrape_it_1.default)(urlOrOpts, opts);
|
|
41
41
|
}
|
|
42
42
|
const jar = new tough_cookie_1.CookieJar();
|
|
43
|
-
const client = (0,
|
|
43
|
+
const client = (0, cookiejar_1.wrapWithCookies)(axios_1.default.create({
|
|
44
44
|
jar,
|
|
45
45
|
withCredentials: true, // Forces passing credentials cross-origin
|
|
46
46
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrapeUrl.js","sourceRoot":"","sources":["../../../../src/lib/sources/bcf/scrapeUrl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AAED,SAAgB,oBAAoB,CAClC,GAAW,EACX,IAA4B;IAE5B,OAAO,SAAS,CAAI,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { sourceForType } from './source';
|
|
2
|
-
export
|
|
2
|
+
export type { CurrentConditions, CurrentConditionsBeta, DailySchedule, DailyScheduleSailing, Departures, Routes, Sailing, SeasonalSchedule, SeasonalScheduleSailing, Source, SourceConfig, } from './types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sources/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,oBAAoB,EACpB,UAAU,EACV,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,YAAY,GACb,MAAM,SAAS,CAAA"}
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
3
|
exports.sourceForType = void 0;
|
|
18
4
|
var source_1 = require("./source");
|
|
19
5
|
Object.defineProperty(exports, "sourceForType", { enumerable: true, get: function () { return source_1.sourceForType; } });
|
|
20
|
-
__exportStar(require("./types"), exports);
|
|
21
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/sources/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/sources/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAA/B,uGAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scrapemyferry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Scapes your ferry data.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"axios": "^1.17.0",
|
|
26
|
-
"axios-cookiejar-support": "^7.0.0",
|
|
27
26
|
"cheerio": "^1.0.0",
|
|
28
27
|
"dayjs": "^1.11.13",
|
|
28
|
+
"http-cookie-agent": "^6",
|
|
29
29
|
"scrape-it": "^6.1.3",
|
|
30
|
-
"tough-cookie": "^
|
|
30
|
+
"tough-cookie": "^5.1.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/jest": "^29.5.12",
|