Comparing version 0.0.9 to 0.0.10
import { ClickToTweetRef } from "./getClickToTweetRefs"; | ||
export interface Quote { | ||
rawText: string; | ||
text: string; | ||
@@ -5,0 +4,0 @@ clickToTweetId: string; |
@@ -5,9 +5,8 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const config_1 = require("./config"); | ||
const QuoteCleaner_1 = require("./QuoteCleaner"); | ||
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 config_1 = require("./config"); | ||
const getClickToTweetRefs_1 = require("./getClickToTweetRefs"); | ||
const axios_1 = (0, tslib_1.__importDefault)(require("axios")); | ||
const cheerio = (0, tslib_1.__importStar)(require("cheerio")); | ||
async function getQuotes() { | ||
@@ -55,8 +54,10 @@ const quotesFilename = "quotes.json"; | ||
const $ = cheerio.load(data); | ||
const rawText = $("title").text(); | ||
const text = $("title").text(); | ||
if (!/\w/.test(text)) { | ||
throw new Error(`getQuoteTest: not a quote on clickToTweetId '${clickToTweetRef.id}' with text '${text}'`); | ||
} | ||
return { | ||
source: clickToTweetRef.source, | ||
clickToTweetId: clickToTweetRef.id, | ||
rawText: rawText, | ||
text: new QuoteCleaner_1.QuoteCleaner(rawText).clean().text, | ||
text, | ||
}; | ||
@@ -63,0 +64,0 @@ } |
{ | ||
"name": "jcscraper", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Scrape utilities for James Clear.com 3-2-1 newsletter", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24892