BLUE
PHP 7.4.33
Path:
/var/www/cvr-leads.bitkit.dk/httpdocs/node_modules/htmlparser2/lib
Run
Logout
Edit File
Size: 6.34 KB
Close
/var/www/cvr-leads.bitkit.dk/httpdocs/node_modules/htmlparser2/lib/FeedHandler.js
Text
Base64
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var domhandler_1 = __importDefault(require("domhandler")); var DomUtils = __importStar(require("domutils")); var Parser_1 = require("./Parser"); //TODO: Consume data as it is coming in var FeedHandler = /** @class */ (function (_super) { __extends(FeedHandler, _super); /** * * @param callback * @param options */ function FeedHandler(callback, options) { var _this = this; if (typeof callback === "object" && callback !== null) { callback = undefined; options = callback; } _this = _super.call(this, callback, options) || this; return _this; } FeedHandler.prototype.onend = function () { var feed = {}; var feedRoot = getOneElement(isValidFeed, this.dom); if (feedRoot) { if (feedRoot.name === "feed") { var childs = feedRoot.children; feed.type = "atom"; addConditionally(feed, "id", "id", childs); addConditionally(feed, "title", "title", childs); var href = getAttribute("href", getOneElement("link", childs)); if (href) { feed.link = href; } addConditionally(feed, "description", "subtitle", childs); var updated = fetch("updated", childs); if (updated) { feed.updated = new Date(updated); } addConditionally(feed, "author", "email", childs, true); feed.items = getElements("entry", childs).map(function (item) { var entry = {}; var children = item.children; addConditionally(entry, "id", "id", children); addConditionally(entry, "title", "title", children); var href = getAttribute("href", getOneElement("link", children)); if (href) { entry.link = href; } var description = fetch("summary", children) || fetch("content", children); if (description) { entry.description = description; } var pubDate = fetch("updated", children); if (pubDate) { entry.pubDate = new Date(pubDate); } return entry; }); } else { var childs = getOneElement("channel", feedRoot.children) .children; feed.type = feedRoot.name.substr(0, 3); feed.id = ""; addConditionally(feed, "title", "title", childs); addConditionally(feed, "link", "link", childs); addConditionally(feed, "description", "description", childs); var updated = fetch("lastBuildDate", childs); if (updated) { feed.updated = new Date(updated); } addConditionally(feed, "author", "managingEditor", childs, true); feed.items = getElements("item", feedRoot.children).map(function (item) { var entry = {}; var children = item.children; addConditionally(entry, "id", "guid", children); addConditionally(entry, "title", "title", children); addConditionally(entry, "link", "link", children); addConditionally(entry, "description", "description", children); var pubDate = fetch("pubDate", children); if (pubDate) entry.pubDate = new Date(pubDate); return entry; }); } } this.feed = feed; this.handleCallback(feedRoot ? null : Error("couldn't find root of feed")); }; return FeedHandler; }(domhandler_1.default)); exports.FeedHandler = FeedHandler; function getElements(what, where) { return DomUtils.getElementsByTagName(what, where, true); } function getOneElement(what, where) { return DomUtils.getElementsByTagName(what, where, true, 1)[0]; } function fetch(what, where, recurse) { if (recurse === void 0) { recurse = false; } return DomUtils.getText(DomUtils.getElementsByTagName(what, where, recurse, 1)).trim(); } function getAttribute(name, elem) { if (!elem) { return null; } var attribs = elem.attribs; return attribs[name]; } function addConditionally(obj, prop, what, where, recurse) { if (recurse === void 0) { recurse = false; } var tmp = fetch(what, where, recurse); // @ts-ignore if (tmp) obj[prop] = tmp; } function isValidFeed(value) { return value === "rss" || value === "feed" || value === "rdf:RDF"; } var defaultOptions = { xmlMode: true }; /** * Parse a feed. * * @param feed The feed that should be parsed, as a string. * @param options Optionally, options for parsing. When using this option, you probably want to set `xmlMode` to `true`. */ function parseFeed(feed, options) { if (options === void 0) { options = defaultOptions; } var handler = new FeedHandler(options); new Parser_1.Parser(handler, options).end(feed); return handler.feed; } exports.parseFeed = parseFeed;
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 21
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
CollectingHandler.d.ts
358 B
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CollectingHandler.d.ts.map
403 B
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CollectingHandler.js
2.20 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeedHandler.d.ts
1.03 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeedHandler.d.ts.map
960 B
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FeedHandler.js
6.34 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.d.ts
1.77 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.d.ts.map
1.02 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.js
2.47 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MultiplexHandler.d.ts
956 B
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MultiplexHandler.d.ts.map
826 B
lrw-r--r--
2025-03-11 10:10:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
MultiplexHandler.js
1.96 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parser.d.ts
3.61 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parser.d.ts.map
2.24 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Parser.js
11.55 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Tokenizer.d.ts
5.19 KB
lrw-r--r--
2025-03-11 10:10:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Tokenizer.d.ts.map
3.56 KB
lrw-r--r--
2025-03-11 10:10:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Tokenizer.js
32.07 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WritableStream.d.ts
602 B
lrw-r--r--
2025-03-11 10:10:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WritableStream.d.ts.map
540 B
lrw-r--r--
2025-03-11 10:10:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
WritableStream.js
1.81 KB
lrw-r--r--
2025-03-11 10:10:55
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).