New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jcscraper

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jcscraper - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

2

dist/config.js

@@ -5,5 +5,5 @@ "use strict";

const tslib_1 = require("tslib");
const path_1 = (0, tslib_1.__importDefault)(require("path"));
const path_1 = tslib_1.__importDefault(require("path"));
exports.cacheDir = path_1.default.join(process.cwd(), ".jcscraper-cache");
exports.newsletterBaseUrl = "https://jamesclear.com/3-2-1";
//# sourceMappingURL=config.js.map

@@ -5,8 +5,8 @@ "use strict";

const tslib_1 = require("tslib");
const path_1 = (0, tslib_1.__importDefault)(require("path"));
const promises_1 = (0, tslib_1.__importDefault)(require("fs/promises"));
const path_1 = tslib_1.__importDefault(require("path"));
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
const getNewsletterUrls_1 = require("./getNewsletterUrls");
const config_1 = require("./config");
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
const cheerio = (0, tslib_1.__importStar)(require("cheerio"));
const axios_1 = tslib_1.__importDefault(require("axios"));
const cheerio = tslib_1.__importStar(require("cheerio"));
async function getClickToTweetRefs() {

@@ -13,0 +13,0 @@ const clickToTweetRefsFilename = "clickToTweetRefs.json";

@@ -5,6 +5,6 @@ "use strict";

const tslib_1 = require("tslib");
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
const promises_1 = (0, tslib_1.__importDefault)(require("fs/promises"));
const cheerio = (0, tslib_1.__importStar)(require("cheerio"));
const path_1 = (0, tslib_1.__importDefault)(require("path"));
const axios_1 = tslib_1.__importDefault(require("axios"));
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
const cheerio = tslib_1.__importStar(require("cheerio"));
const path_1 = tslib_1.__importDefault(require("path"));
const config_1 = require("./config");

@@ -11,0 +11,0 @@ async function getNewsletterUrls() {

@@ -0,3 +1,9 @@

import { z } from "zod";
import { ClickToTweetRef } from "./getClickToTweetRefs";
export interface Quote {
export declare const quoteSchema: z.ZodObject<{
rawText: z.ZodString;
text: z.ZodString;
clickToTweetId: z.ZodString;
source: z.ZodString;
}, "strip", z.ZodTypeAny, {
rawText: string;

@@ -7,4 +13,27 @@ text: string;

source: string;
}
export declare function getQuotes(): Promise<Quote[]>;
}, {
rawText: string;
text: string;
clickToTweetId: string;
source: string;
}>;
export declare const quotesSchema: z.ZodArray<z.ZodObject<{
rawText: z.ZodString;
text: z.ZodString;
clickToTweetId: z.ZodString;
source: z.ZodString;
}, "strip", z.ZodTypeAny, {
rawText: string;
text: string;
clickToTweetId: string;
source: string;
}, {
rawText: string;
text: string;
clickToTweetId: string;
source: string;
}>, "many">;
export type Quote = z.infer<typeof quoteSchema>;
export type Quotes = z.infer<typeof quotesSchema>;
export declare function getQuotes(): Promise<Quotes>;
export declare function scrapeQuote(clickToTweetRef: ClickToTweetRef): Promise<Quote | {

@@ -11,0 +40,0 @@ error: unknown;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.scrapeQuote = exports.getQuotes = void 0;
exports.scrapeQuote = exports.getQuotes = exports.quotesSchema = exports.quoteSchema = void 0;
const tslib_1 = require("tslib");
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
const cheerio = (0, tslib_1.__importStar)(require("cheerio"));
const promises_1 = (0, tslib_1.__importDefault)(require("fs/promises"));
const path_1 = (0, tslib_1.__importDefault)(require("path"));
const axios_1 = tslib_1.__importDefault(require("axios"));
const cheerio = tslib_1.__importStar(require("cheerio"));
const promises_1 = tslib_1.__importDefault(require("fs/promises"));
const path_1 = tslib_1.__importDefault(require("path"));
const zod_1 = require("zod");
const config_1 = require("./config");
const getClickToTweetRefs_1 = require("./getClickToTweetRefs");
const QuoteCleaner_1 = require("./QuoteCleaner");
exports.quoteSchema = zod_1.z.object({
rawText: zod_1.z.string(),
text: zod_1.z.string(),
clickToTweetId: zod_1.z.string(),
source: zod_1.z.string(),
});
exports.quotesSchema = zod_1.z.array(exports.quoteSchema);
async function getQuotes() {

@@ -19,3 +27,3 @@ const quotesFilename = "quotes.json";

console.log(`Found file with previous scraped data. Returning ${quotes.length} cached quotes.`);
return quotes;
return exports.quotesSchema.parse(quotes);
}

@@ -22,0 +30,0 @@ catch (e) {

export { getNewsletterUrls } from "./getNewsletterUrls";
export { getClickToTweetRefs, scrapeClickToTweetRefs, } from "./getClickToTweetRefs";
export { getQuotes, scrapeQuote } from "./getQuotes";
export { getQuotes, scrapeQuote, quoteSchema, quotesSchema } from "./getQuotes";
export { newsletterBaseUrl } from "./config";
export type { Quote as QuoteType } from "./getQuotes";
export type { Quote, Quotes } from "./getQuotes";
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.newsletterBaseUrl = exports.scrapeQuote = exports.getQuotes = exports.scrapeClickToTweetRefs = exports.getClickToTweetRefs = exports.getNewsletterUrls = void 0;
exports.newsletterBaseUrl = exports.quotesSchema = exports.quoteSchema = exports.scrapeQuote = exports.getQuotes = exports.scrapeClickToTweetRefs = exports.getClickToTweetRefs = exports.getNewsletterUrls = void 0;
var getNewsletterUrls_1 = require("./getNewsletterUrls");

@@ -12,4 +12,6 @@ Object.defineProperty(exports, "getNewsletterUrls", { enumerable: true, get: function () { return getNewsletterUrls_1.getNewsletterUrls; } });

Object.defineProperty(exports, "scrapeQuote", { enumerable: true, get: function () { return getQuotes_1.scrapeQuote; } });
Object.defineProperty(exports, "quoteSchema", { enumerable: true, get: function () { return getQuotes_1.quoteSchema; } });
Object.defineProperty(exports, "quotesSchema", { enumerable: true, get: function () { return getQuotes_1.quotesSchema; } });
var config_1 = require("./config");
Object.defineProperty(exports, "newsletterBaseUrl", { enumerable: true, get: function () { return config_1.newsletterBaseUrl; } });
//# sourceMappingURL=index.js.map
{
"name": "jcscraper",
"version": "0.0.14",
"version": "0.0.15",
"description": "Scrape utilities for James Clear 3-2-1 newsletter",

@@ -19,3 +19,4 @@ "main": "dist/index.js",

"axios": "^0.21.4",
"cheerio": "^1.0.0-rc.10"
"cheerio": "^1.0.0-rc.10",
"zod": "^3.20.6"
},

@@ -22,0 +23,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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