Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scrapq

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scrapq - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

.gitlab-ci.yml

5

CHANGELOG.md

@@ -9,2 +9,7 @@ # Changelog

## [2.1.0] - 2020-18-04
- Added support for `exist` selector
- Rename `GeType` to `TypeOfQuery`
## [2.0.0] - 2020-13-02

@@ -11,0 +16,0 @@

4

dist/browser/scrapq.min.js

@@ -1,2 +0,2 @@

var scrapq=function(t){var e={};function r(n){if(e[n])return e[n].exports;var u=e[n]={i:n,l:!1,exports:{}};return t[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var u in t)r.d(n,u,function(e){return t[e]}.bind(null,u));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),u=r(2),o=r(3);function c(t){return"type"in t&&"select"in t}function i(t,e,r){switch(r.type){case"text":var n=""===r.select?t(e).text():t(r.select,e).text();return n||n.trim();case"attr":return(f=""===r.select?e:t(r.select,e)).attr(r.attr);case"count":return(o=t(r.select,e)).length;case"list":for(var u=[],o=t(r.select,e),s=0;s<o.length;s++){var f=o.eq(s),a=c(r.query)?i(t,f,r.query):l(t,f,r.query,{});u.push(a)}return u;case"html":if(""===r.select)return t(e).html();var p=(f=t(r.select,e)).html();return"string"==typeof p?p.trim():p;default:throw new Error('Undefined selector "'+JSON.stringify(r)+'"')}}function l(t,e,r,n){return Object.keys(r).forEach((function(u){var o=r[u];c(o)?n[u]=i(t,e,o):n[u]=l(t,e,o,{})})),n}e.scrap=function(t,e){var r=n.load(t),u=r.root();return c(e)?i(r,u,e):l(r,u,e,{})},e.$={attr:u.attr,text:u.text,count:u.count,list:o.list,html:u.html}},function(t,e){t.exports=cheerio},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.attr=function(t,e){return{type:"attr",select:t,attr:e}},e.text=function(t){return{type:"text",select:t}},e.count=function(t){return{type:"count",select:t}},e.html=function(t){return{type:"html",select:t}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.list=function(t,e){return{type:"list",select:t,query:e}}}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9zY3JhcHEvd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vc2NyYXBxLy4vbGliL2luZGV4LnRzIiwid2VicGFjazovL3NjcmFwcS9leHRlcm5hbCBcImNoZWVyaW9cIiIsIndlYnBhY2s6Ly9zY3JhcHEvLi9saWIvc2VsZWN0b3JzLnRzIiwid2VicGFjazovL3NjcmFwcS8uL2xpYi9jb250cm9scy50cyJdLCJuYW1lcyI6WyJpbnN0YWxsZWRNb2R1bGVzIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsIm1vZHVsZUlkIiwiZXhwb3J0cyIsIm1vZHVsZSIsImkiLCJsIiwibW9kdWxlcyIsImNhbGwiLCJtIiwiYyIsImQiLCJuYW1lIiwiZ2V0dGVyIiwibyIsIk9iamVjdCIsImRlZmluZVByb3BlcnR5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3QgYXR0ciA9IGVsLmF0dHIoc2VsZWN0b3IuYXR0cik7XG4gICAgICAgICAgICByZXR1cm4gYXR0cjtcbiAgICAgICAgfVxuICAgICAgICBjYXNlIFwiY291bnRcIjoge1xuICAgICAgICAgICAgY29uc3QgZWxzID0gJChzZWxlY3Rvci5zZWxlY3QsIGNvbnRleHQpO1xuICAgICAgICAgICAgY29uc3QgY291bnQgPSBlbHMubGVuZ3RoO1xuICAgICAgICAgICAgcmV0dXJuIGNvdW50O1xuICAgICAgICB9XG4gICAgICAgIGNhc2UgXCJsaXN0XCI6IHtcbiAgICAgICAgICAgIGNvbnN0IHJlc3VsdDogYW55W10gPSBbXTtcbiAgICAgICAgICAgIGNvbnN0IGVscyA9ICQoc2VsZWN0b3Iuc2VsZWN0LCBjb250ZXh0KTtcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZWxzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZWwgPSBlbHMuZXEoaSk7XG4gICAgICAgICAgICAgICAgY29uc3Qgc2NyYXBlZEVsID0gaXNTZWxlY3Rvck9yQ29udHJvbChzZWxlY3Rvci5xdWVyeSlcbiAgICAgICAgICAgICAgICAgICAgPyBzY3JhcFNlbGVjdG9yKCQsIGVsLCBzZWxlY3Rvci5xdWVyeSlcbiAgICAgICAgICAgICAgICAgICAgOiBzY3JhcFF1ZXJ5KCQsIGVsLCBzZWxlY3Rvci5xdWVyeSwge30pO1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKHNjcmFwZWRFbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG4gICAgICAgIGNhc2UgXCJodG1sXCI6IHtcbiAgICAgICAgICAgIGlmIChzZWxlY3Rvci5zZWxlY3QgPT09IFwiXCIpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBodG1sID0gJChjb250ZXh0KS5odG1sKCk7XG4gICAgICAgICAg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1cblxuLy8gRVhQT1JUU1xuXG5leHBvcnQgaW50ZXJmYWNlIExpc3RUeXBlPFEgZXh0ZW5kcyBBbnlTZWxlY3RvciB8IEFueUNvbnRyb2wgfCBRdWVyeT4ge1xuICAgIHR5cGU6IFwibGlzdFwiO1xuICAgIHNlbGVjdDogc3RyaW5nO1xuICAgIHF1ZXJ5OiBRO1xufVxuXG5leHBvcnQgdHlwZSBBbnlDb250cm9sID0gTGlzdFR5cGU8YW55PjtcblxuLy8gRFNMXG5cbmV4cG9ydCBmdW5jdGlvbiBsaXN0PFEgZXh0ZW5kcyBRdWVyeSB8IEFueUNvbnRyb2wgfCBBbnlTZWxlY3Rvcj4oc2VsZWN0b3I6IHN0cmluZywgcXVlcnk6IFEpOiBMaXN0VHlwZTxRPiB7XG4gICAgcmV0dXJuIHtcbiAgICAgICAgdHlwZTogXCJsaXN0XCIsXG4gICAgICAgIHNlbGVjdDogc2VsZWN0b3IsXG4gICAgICAgIHF1ZXJ5XG4gICAgfTtcbn1cbiJdLCJzb3VyY2VSb290IjoiIn0=
var scrapq=function(t){var e={};function r(n){if(e[n])return e[n].exports;var u=e[n]={i:n,l:!1,exports:{}};return t[n].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var u in t)r.d(n,u,function(e){return t[e]}.bind(null,u));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(1),u=r(2),c=r(3);function o(t){return"type"in t&&"select"in t}function i(t,e,r){switch(r.type){case"text":var n=""===r.select?t(e).text():t(r.select,e).text();return n&&n.trim();case"attr":return(f=""===r.select?e:t(r.select,e)).attr(r.attr);case"count":return(c=t(r.select,e)).length;case"exists":return!!(c=t(r.select,e)).length;case"list":for(var u=[],c=t(r.select,e),l=0;l<c.length;l++){var f=c.eq(l),a=o(r.query)?i(t,f,r.query):s(t,f,r.query,{});u.push(a)}return u;case"html":if(""===r.select)return t(e).html();var p=(f=t(r.select,e)).html();return"string"==typeof p?p.trim():p;default:throw new Error('Undefined selector "'+JSON.stringify(r)+'"')}}function s(t,e,r,n){return Object.keys(r).forEach((function(u){var c=r[u];o(c)?n[u]=i(t,e,c):n[u]=s(t,e,c,{})})),n}e.scrap=function(t,e){var r=n.load(t),u=r.root();return o(e)?i(r,u,e):s(r,u,e,{})},e.$={attr:u.attr,text:u.text,count:u.count,list:c.list,html:u.html,exists:u.exists}},function(t,e){t.exports=cheerio},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.attr=function(t,e){return{type:"attr",select:t,attr:e}},e.text=function(t){return{type:"text",select:t}},e.count=function(t){return{type:"count",select:t}},e.html=function(t){return{type:"html",select:t}},e.exists=function(t){return{type:"exists",select:t}}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.list=function(t,e){return{type:"list",select:t,query:e}}}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9zY3JhcHEvd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vc2NyYXBxLy4vbGliL2luZGV4LnRzIiwid2VicGFjazovL3NjcmFwcS9leHRlcm5hbCBcImNoZWVyaW9cIiIsIndlYnBhY2s6Ly9zY3JhcHEvLi9saW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AgICAgICAgY29uc3QgdGV4dCA9IChzZWxlY3Rvci5zZWxlY3QgPT09IFwiXCIpXG4gICAgICAgICAgICAgICAgPyAkKGNvbnRleHQpLnRleHQoKVxuICAgICAgICAgICAgICAgIDogJChzZWxlY3Rvci5zZWxlY3QsIGNvbnRleHQpLnRleHQoKTtcbiAgICAgICAgICAgIHJldHVybiB0ZXh0ICYmIHRleHQudHJpbSgpO1xuICAgICAgICB9XG4gICAgICAgIGNhc2UgXCJhdHRyXCI6IHtcbiAgICAgICAgICAgIGNvbnN0IGVsID0gKHNlbGVjdG9yLnNlbGVjdCA9PT0gXCJcIilcbiAgICAgICAgICAgICAgICA/IGNvbnRleHRcbiAgICAgICAgICAgICAgICA6ICQoc2VsZWN0b3Iuc2VsZWN0LCBjb250ZXh0KTtcbiAgICAgICAgICAgIGNvbnN0IGF0dHIgPSBlbC5hdHRyKHNlbGVjdG9yLmF0dHIpO1xuICAgICAgICAgICAgcmV0dXJuIGF0dHI7XG4gICAgICAgIH1cbiAgICAgICAgY2FzZSBcImNvdW50XCI6IHtcbiAgICAgICAgICAgIGNvbnN0IGVscyA9ICQoc2VsZWN0b3Iuc2VsZWN0LCBjb250ZXh0KTtcbiAgICAgICAgICAgIGNvbnN0IGNvdW50ID0gZWxzLmxlbmd0aDtcbiAgICAgICAgICAgIHJldHVybiBjb3VudDtcbiAgICAgICAgfVxuICAgICAgICBjYXNlIFwiZXhpc3RzXCI6IHtcbiAgICAgICAgICAgIGNvbnN0IGVscyA9ICQoc2VsZWN0b3Iuc2VsZWN0LCBjb250ZXh0KTtcbiAgICAgICAgICAgIGNvbnN0IGV4aXN0cyA9IGVscy5sZW5ndGggPyB0cnVlIDogZmFsc2U7XG4gICAgICAgICAgICByZXR1cm4gZXhpc3RzO1xuICAgICAgICB9XG4gICAgICAgIGNhc2UgXCJsaXN0XCI6IHtcbiAgICAgICAgICAgIGNvbnN0IHJlc3VsdDogYW55W10gPSBbXTtcbiAgICAgICAgICAgIGNvbnN0IGVscyA9ICQoc2VsZWN0b3Iuc2VsZWN0LCBjb250ZXh0KTtcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgZWxzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgY29uc3QgZWwgPSBlbHMuZXEoaSk7XG4gICAgICAgICAgICAgICAgY29uc3Qgc2NyYXBlZEVsID0gaXNTZWxlY3Rvck9yQ29udHJvbChzZWxlY3Rvci5xdWVyeSlcbiAgICAgICAgICAgICAgICAgICAgPyBzY3JhcFNlbGVjdG9yKCQsIGVsLCBzZWxlY3Rvci5xdWVyeSlcbiAgICAgICAgICAgICAgICAgICAgOiBzY3JhcFF1ZXJ5KCQsIGVsLCBzZWxlY3Rvci5xdWVyeSwge30pO1xuICAgICAgICAgICAgICAgIHJlc3VsdC5wdXNoKHNjcmFwZWRFbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9XG4gICAgICAgIGNhc2UgXCJodG1sXCI6IHtcbiAgICAgICAgICAgIGlmIChzZWxlY3Rvci5zZWxlY3QgPT09IFwiXCIpIHtcbiAgICAgICAgICAgICAgICBjb25zdCBodG1sID0gJChjb250ZXh0KS5odG1sKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGh0bWw7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGNvbnN0IGVsID0gJChzZWxlY3Rvci5zZWxlY3QsIGNvbnRleHQpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGh0bWwgPSBlbC5odG1sKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuICh0eXBlb2YgaHRtbCA9PT0gXCJzdHJpbmdcIilcbiAgICAgICAgICAgICAgICAgICAgPyBodG1sLnRyaW0oKVxuICAgICAgICAgICAgICAgICAgICA6IGh0bWw7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgZGVmYXVsdDoge1xuICAgICAgICAgICAgdGhy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HR5cGUgQW55Q29udHJvbCA9IExpc3RUeXBlPGFueT47XG5cbi8vIERTTFxuXG5leHBvcnQgZnVuY3Rpb24gbGlzdDxRIGV4dGVuZHMgUXVlcnkgfCBBbnlDb250cm9sIHwgQW55U2VsZWN0b3I+KHNlbGVjdG9yOiBzdHJpbmcsIHF1ZXJ5OiBRKTogTGlzdFR5cGU8UT4ge1xuICAgIHJldHVybiB7XG4gICAgICAgIHR5cGU6IFwibGlzdFwiLFxuICAgICAgICBzZWxlY3Q6IHNlbGVjdG9yLFxuICAgICAgICBxdWVyeVxuICAgIH07XG59XG4iXSwic291cmNlUm9vdCI6IiJ9

@@ -1,2 +0,2 @@

import { AnySelector, SelectorTypes } from "./selectors";
import { AnySelector } from "./selectors";
import { ListType, AnyControl } from "./controls";

@@ -6,8 +6,15 @@ export interface Query {

}
export declare type GetResult<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorTypes[Q["type"]] : never;
1: Q extends ListType<infer T> ? GetResult<T>[] : never;
export interface SelectorResultType {
text: string;
attr: string;
count: number;
html: string;
exists: boolean;
}
export declare type TypeOfQuery<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorResultType[Q["type"]] : never;
1: Q extends ListType<infer T> ? TypeOfQuery<T>[] : never;
2: Q extends Query ? {
[prop in keyof Q]: GetResult<Q[prop]>;
[prop in keyof Q]: TypeOfQuery<Q[prop]>;
} : never;
}[Q extends AnySelector ? 0 : Q extends ListType<any> ? 1 : Q extends Query ? 2 : boolean];

@@ -1,5 +0,5 @@

import { AnySelector, text, count, attr, html } from "./selectors";
import { Query, GetResult } from "./helpers";
import { AnySelector, text, count, attr, html, exists } from "./selectors";
import { Query, TypeOfQuery } from "./helpers";
import { AnyControl, list } from "./controls";
export declare function scrap<Q extends Query | AnyControl | AnySelector>(html: string, query: Q): GetResult<Q>;
export declare function scrap<Q extends Query | AnyControl | AnySelector>(html: string, query: Q): TypeOfQuery<Q>;
export declare const $: {

@@ -11,2 +11,3 @@ attr: typeof attr;

html: typeof html;
exists: typeof exists;
};

@@ -18,3 +18,3 @@ "use strict";

: $(selector.select, context).text();
return text_1 || text_1.trim();
return text_1 && text_1.trim();
}

@@ -33,2 +33,7 @@ case "attr": {

}
case "exists": {
var els = $(selector.select, context);
var exists_1 = els.length ? true : false;
return exists_1;
}
case "list": {

@@ -92,4 +97,5 @@ var result = [];

list: controls_1.list,
html: selectors_1.html
html: selectors_1.html,
exists: selectors_1.exists,
};
//# sourceMappingURL=index.js.map
// Generated by dts-bundle v0.7.3
declare module 'scrapq' {
import { AnySelector, text, count, attr, html } from "scrapq/selectors";
import { Query, GetResult } from "scrapq/helpers";
import { AnySelector, text, count, attr, html, exists } from "scrapq/selectors";
import { Query, TypeOfQuery } from "scrapq/helpers";
import { AnyControl, list } from "scrapq/controls";
export function scrap<Q extends Query | AnyControl | AnySelector>(html: string, query: Q): GetResult<Q>;
export function scrap<Q extends Query | AnyControl | AnySelector>(html: string, query: Q): TypeOfQuery<Q>;
export const $: {

@@ -14,2 +14,3 @@ attr: typeof attr;

html: typeof html;
exists: typeof exists;
};

@@ -36,9 +37,7 @@ }

}
export interface SelectorTypes {
text: string;
attr: string;
count: number;
html: string;
interface ExistsType {
type: "exists";
select: string;
}
export type AnySelector = TextType | AttrType | CountType | HtmlType;
export type AnySelector = TextType | AttrType | CountType | HtmlType | ExistsType;
export function attr(selector: string, attribute: string): AttrType;

@@ -48,2 +47,3 @@ export function text(selector: string): TextType;

export function html(selector: string): HtmlType;
export function exists(selector: string): ExistsType;
export {};

@@ -53,3 +53,3 @@ }

declare module 'scrapq/helpers' {
import { AnySelector, SelectorTypes } from "scrapq/selectors";
import { AnySelector } from "scrapq/selectors";
import { ListType, AnyControl } from "scrapq/controls";

@@ -59,7 +59,14 @@ export interface Query {

}
export type GetResult<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorTypes[Q["type"]] : never;
1: Q extends ListType<infer T> ? GetResult<T>[] : never;
export interface SelectorResultType {
text: string;
attr: string;
count: number;
html: string;
exists: boolean;
}
export type TypeOfQuery<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorResultType[Q["type"]] : never;
1: Q extends ListType<infer T> ? TypeOfQuery<T>[] : never;
2: Q extends Query ? {
[prop in keyof Q]: GetResult<Q[prop]>;
[prop in keyof Q]: TypeOfQuery<Q[prop]>;
} : never;

@@ -66,0 +73,0 @@ }[Q extends AnySelector ? 0 : Q extends ListType<any> ? 1 : Q extends Query ? 2 : boolean];

@@ -18,9 +18,7 @@ interface CountType {

}
export interface SelectorTypes {
text: string;
attr: string;
count: number;
html: string;
interface ExistsType {
type: "exists";
select: string;
}
export declare type AnySelector = TextType | AttrType | CountType | HtmlType;
export declare type AnySelector = TextType | AttrType | CountType | HtmlType | ExistsType;
export declare function attr(selector: string, attribute: string): AttrType;

@@ -30,2 +28,3 @@ export declare function text(selector: string): TextType;

export declare function html(selector: string): HtmlType;
export declare function exists(selector: string): ExistsType;
export {};

@@ -33,2 +33,9 @@ "use strict";

exports.html = html;
function exists(selector) {
return {
type: "exists",
select: selector
};
}
exports.exists = exists;
//# sourceMappingURL=selectors.js.map

@@ -1,2 +0,2 @@

import { AnySelector, SelectorTypes } from "./selectors";
import { AnySelector } from "./selectors";
import { ListType, AnyControl } from "./controls";

@@ -8,7 +8,15 @@

export type GetResult<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorTypes[Q["type"]] : never;
1: Q extends ListType<infer T> ? GetResult<T>[] : never;
export interface SelectorResultType {
text: string;
attr: string;
count: number;
html: string;
exist: boolean;
}
export type TypeOfQuery<Q extends AnySelector | ListType<any> | Query> = {
0: Q extends AnySelector ? SelectorResultType[Q["type"]] : never;
1: Q extends ListType<infer T> ? TypeOfQuery<T>[] : never;
2: Q extends Query ? {
[prop in keyof Q]: GetResult<Q[prop]>
[prop in keyof Q]: TypeOfQuery<Q[prop]>
}: never;

@@ -15,0 +23,0 @@ }[Q extends AnySelector ? 0

import { load } from "cheerio";
import { AnySelector, text, count, attr, html } from "./selectors";
import { Query, GetResult } from "./helpers";
import { AnySelector, text, count, attr, html, exist } from "./selectors";
import { Query, TypeOfQuery } from "./helpers";
import { AnyControl, list } from "./controls";

@@ -19,3 +19,3 @@

: $(selector.select, context).text();
return text || text.trim();
return text && text.trim();
}

@@ -34,2 +34,7 @@ case "attr": {

}
case "exist": {
const els = $(selector.select, context);
const exist = els.length ? true : false;
return exist;
}
case "list": {

@@ -65,3 +70,3 @@ const result: any[] = [];

function scrapQuery<Q extends Query>($: CheerioStatic, context: Cheerio, query: Q, ref: any): GetResult<Q> {
function scrapQuery<Q extends Query>($: CheerioStatic, context: Cheerio, query: Q, ref: any): TypeOfQuery<Q> {
Object.keys(query).forEach(prop => {

@@ -78,8 +83,6 @@ const val = query[prop];

export function scrap<Q extends Query | AnyControl | AnySelector>(
html: string,
query: Q
): GetResult<Q> {
): TypeOfQuery<Q> {
const $ = load(html);

@@ -99,3 +102,4 @@ const root = $.root();

list,
html
html,
exist,
};

@@ -22,13 +22,11 @@ interface CountType {

interface ExistType {
type: "exist",
select: string;
}
// EXPORTS
export interface SelectorTypes {
text: string;
attr: string;
count: number;
html: string;
}
export type AnySelector = TextType | AttrType | CountType | HtmlType | ExistType;
export type AnySelector = TextType | AttrType | CountType | HtmlType;
// DSL

@@ -62,3 +60,10 @@

select: selector
}
};
}
export function exist(selector: string): ExistType {
return {
type: "exist",
select: selector
};
}
{
"name": "scrapq",
"version": "2.0.1",
"version": "2.1.0",
"description": "Lightweight Typescript library for scrapping html",

@@ -9,5 +9,3 @@ "main": "./dist/index.js",

"scripts": {
"test": "npm run test:basic && npm run test:exhaustive",
"test:basic": "jasmine-ts ./test/basic.test.ts",
"test:exhaustive": "jasmine-ts ./test/**/*.ts",
"test": "ts-node node_modules/tape/bin/tape test/**/*.ts",
"dist": "npm run test; npm run build; npm run build:web",

@@ -31,7 +29,6 @@ "build": "npm run build:node && npm run build:web && npm run build:dts",

"devDependencies": {
"@types/jasmine": "^2.8.16",
"@types/node": "^10.17.15",
"jasmine": "^3.5.0",
"jasmine-ts": "^0.2.1",
"ts-loader": "^5.4.5",
"@types/tape": "^4.2.34",
"tape": "^4.13.2",
"ts-loader": "^7.0.0",
"ts-node": "^8.8.2",
"typescript": "^3.7.5",

@@ -38,0 +35,0 @@ "webpack": "^4.41.6",

@@ -104,22 +104,26 @@ # ScrapQ

`Q.text(selector: string): string`
`$.text(selector: string): string`
get text from an element
`Q.attr(selector: string, htmlAttribute: string): string`
`$.attr(selector: string, htmlAttribute: string): string`
get attribute from an element
`Q.html(selector: string): string`
`$.html(selector: string): string`
get html
`Q.count(selector: string): number`
`$.count(selector: string): number`
get elements count
`$.exist(selector: string): boolean`
check if element exists
### Controls
`Q.List(selector: string, query: Query | QueryType, predicate?): Array<query>`
`$.list(selector: string, query: Query | QueryType, predicate?): Array<query>`
get list of items

@@ -0,1 +1,2 @@

import test from "tape";
import { scrap, $ } from '../lib';

@@ -13,19 +14,21 @@

describe('Basic', () => {
test('Basic', (main) => {
it('should scrap <h1/> text from string', () => {
test('should scrap <h1/> text from string', (t) => {
const result = scrap(STR_TO_SCRAP, {
title: $.text('h1.title')
});
expect(result).toEqual({ title: 'Hello'});
t.equal(result, { title: 'Hello'});
t.end();
});
it('should scrap attributes from <h1/>', () => {
test('should scrap attributes from <h1/>', (t) => {
const result = scrap(STR_TO_SCRAP, {
title: $.attr('h1.title', 'class')
});
expect(result).toEqual({ title: 'title'});
t.equal(result, { title: 'title'});
t.end();
});
it('should scrap items from <span/>', () => {
test('should scrap items from <span/>', (t) => {
const result = scrap(STR_TO_SCRAP, {

@@ -36,7 +39,8 @@ items: $.list('li', {

});
expect(result.items.length).toBe(3);
expect(result.items[2].text).toBe('Bonjour')
t.equal(result.items.length, 3);
t.equal(result.items[2].text, 'Bonjour');
t.end();
});
it('should scrap text from <li><span/>', () => {
test('should scrap text from <li><span/>', (t) => {
const result = scrap(STR_TO_SCRAP, {

@@ -47,7 +51,8 @@ items: $.list('li', {

});
expect(result.items.length).toBe(3);
expect(result.items[2].text).toBe('Bonjour')
t.equal(result.items.length, 3);
t.equal(result.items[2].text, 'Bonjour');
t.end();
});
it('should scrap text from <span/> by omitting <li/>', () => {
test('should scrap text from <span/> by omitting <li/>', (t) => {
const result = scrap(STR_TO_SCRAP, {

@@ -58,11 +63,12 @@ items: $.list('span', {

});
expect(result.items.length).toBe(3);
expect(result.items[2].text).toBe('Bonjour')
t.equal(result.items.length, 3);
t.equal(result.items[2].text, 'Bonjour');
t.end();
});
it('should get list of texts', () => {
test('should get list of texts', (t) => {
const result = scrap(STR_TO_SCRAP, {
texts: $.list('li', $.text('span'))
});
expect(result.texts).toEqual([
t.equals(result.texts, [
'Guten Tag',

@@ -72,5 +78,6 @@ 'Ciao',

]);
t.end();
});
it('should user deep query', () => {
test('should user deep query', (t) => {
const result = scrap(STR_TO_SCRAP, {

@@ -82,31 +89,36 @@ title: $.text('.title'),

});
expect(result.title).toBe('Hello');
expect(result.data.msg).toBe('Ciao');
t.equal(result.title, 'Hello');
t.equal(result.data.msg, 'Ciao');
t.end();
});
it('should count <span/> elements', () => {
test('should count <span/> elements', (t) => {
const result = scrap(STR_TO_SCRAP, {
spanCount: $.count('span')
});
expect(result.spanCount).toBe(3);
t.equal(result.spanCount, 3);
t.end();
});
it('should count not exists element', () => {
test('should count not exists element', (t) => {
const result = scrap(STR_TO_SCRAP, {
spanCount: $.count('table')
});
expect(result.spanCount).toBe(0);
t.equal(result.spanCount, 0);
t.end();
});
it('should use only selector to scrap title', () => {
test('should use only selector to scrap title', (t) => {
const title = scrap(STR_TO_SCRAP, $.text('.title'));
expect(title).toBe('Hello');
t.equal(title, 'Hello');
});
it('should use only selector to scrap <span/>', () => {
test('should use only selector to scrap <span/>', (t) => {
const spans = scrap(STR_TO_SCRAP, $.list('span', $.text('')));
expect(spans.length).toBe(3);
expect(spans[0]).toBe('Guten Tag');
t.equal(spans.length, 3);
t.equal(spans[0], 'Guten Tag');
t.end();
});
main.end();
});

@@ -0,12 +1,15 @@

import test from "tape";
import { scrap, $ } from "../../lib";
import { html } from "../data";
describe("select", () => {
it("should scrap items from <span/>", () => {
test("select", (main) => {
test("should scrap items from <span/>", (t) => {
const spans = scrap(html, $.list("span", $.text("")));
expect(spans.length).toBe(3);
expect(spans[0]).toBe("Guten Tag");
t.equal(spans.length, 3);
t.equal(spans[0], "Guten Tag");
t.end();
});
it("should scrap items from <span/> using query", () => {
test("should scrap items from <span/> using query", (t) => {
const result = scrap(html, {

@@ -17,5 +20,8 @@ items: $.list("li", {

});
expect(result.items.length).toBe(3);
expect(result.items[2].text).toBe("Bonjour");
t.equal(result.items.length, 3);
t.equal(result.items[2].text, "Bonjour");
t.end();
});
main.end();
});

@@ -0,1 +1,2 @@

import test from "tape";
import { readFileSync } from "fs";

@@ -6,4 +7,5 @@ import { scrap, $ } from "../../lib";

describe("agescx documentation", () => {
it("should get all navigation items from agescx", () => {
test("agescx documentation", (main) => {
test("should get all navigation items from agescx", (t) => {
const result = scrap(shtml, {

@@ -22,8 +24,11 @@ navs: $.list("ul.navbar-nav>li:not(.disabled)", {

expect(result.navs.length).toBe(9);
expect(result.navs[2].submenu.length).toBe(2);
expect(result.navs[2].submenu[0].text).toBe("Adding new unit");
expect(result.content.length).toBeGreaterThan(30);
expect(result.title).toBe("Agescx Documentation");
t.equal(result.navs.length, 9);
t.equal(result.navs[2].submenu.length, 2);
t.equal(result.navs[2].submenu[0].text, "Adding new unit");
t.equal(result.content.length, 1114);
t.equal(result.title, "Agescx Documentation");
t.end();
});
main.end();
});

@@ -0,21 +1,28 @@

import test from "tape";
import { scrap, $ } from "../../lib";
import { html } from "../data";
describe("attr", () => {
it("should scrap href attr from an <a/>", () => {
test("attr", (main) => {
test("should scrap href attr from an <a/>", (t) => {
const result = scrap(html, $.attr("a", "href"));
expect(result).toBe("/read-more");
t.equal(result, "/read-more");
t.end();
});
it("should scrap data-extra from <div/>", () => {
test("should scrap data-extra from <div/>", (t) => {
const result = scrap(html, $.attr(".footer", "data-extra"));
expect(result).toBe("footer");
t.equal(result, "footer");
t.end();
});
it("should scrap data using query", () => {
test("should scrap data using query", (t) => {
const result = scrap(html, {
footer: $.attr(".footer", "data-extra")
});
expect(result.footer).toBe("footer");
t.equal(result.footer, "footer");
t.end();
});
main.end();
});

@@ -0,26 +1,34 @@

import test from "tape";
import { scrap, $ } from "../../lib";
import { html } from "../data";
describe("count", () => {
it("should count <li/> elements", () => {
test("count", (main) => {
test("should count <li/> elements", (t) => {
const result = scrap(html, $.count("li"));
expect(result).toBe(3);
t.equal(result, 3);
t.end();
});
it("should count <h1/>", () => {
test("should count <h1/>", (t) => {
const result = scrap(html, $.count("h1"));
expect(result).toBe(1);
t.equal(result, 1);
t.end();
});
it("should count non-existing element", () => {
test("should count non-existing element", (t) => {
const result = scrap(html, $.count("h3"));
expect(result).toBe(0);
t.equal(result, 0);
t.end();
});
it("should count using query", () => {
test("should count using query", (t) => {
const result = scrap(html, {
liCounts: $.count("li")
});
expect(result.liCounts).toBe(3);
t.equal(result.liCounts, 3);
t.end();
});
main.end();
});

@@ -0,16 +1,22 @@

import test from "tape";
import { scrap, $ } from "../../lib";
import { html } from "../data";
describe("html", () => {
it("should get html from <ul/>", () => {
test("html", (main) => {
test("should get html from <ul/>", (t) => {
const result = scrap(html, $.html("ul>li:first-child"));
expect(result).toBe(`<span>Guten Tag</span>`);
t.equal(result, `<span>Guten Tag</span>`);
t.end();
});
it("should count using query", () => {
test("should count using query", (t) => {
const result = scrap(html, {
footer: $.html("ul>li:last-child")
});
expect(result.footer).toBe(`<span>Bonjour</span>`);
t.equal(result.footer, `<span>Bonjour</span>`);
t.end();
});
main.end();
});

@@ -0,21 +1,28 @@

import test from "tape";
import { scrap, $ } from "../../lib";
import { html } from "../data";
describe("text", () => {
it("should get text from .msg", () => {
test("text", (main) => {
test("should get text from .msg", (t) => {
const result = scrap(html, $.text(".msg"));
expect(result).toBe("Ciao");
t.equal(result, "Ciao");
t.end();
});
it("should not get text from non existing element", () => {
test("should not get text from non existing element", (t) => {
const result = scrap(html, $.text("h3"));
expect(result).toBe("");
t.equal(result, "");
t.end();
});
it("should count using query", () => {
test("should count using query", (t) => {
const result = scrap(html, {
link: $.text("a")
});
expect(result.link).toBe("read more ...");
t.equal(result.link, "read more ...");
t.end();
});
main.end();
});
# TODO
- [ ] add strict mode for parsing
- [x] add if control
- [ ] add if control
- [ ] better context passing (if)

@@ -9,2 +9,1 @@ - [ ] fix test for non existing elements

- [x] test nested lists
- [x] callback function to convert selector output

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc