Skip to content

Commit

Permalink
fix(scrapeURL): crawl stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
mogery committed Nov 5, 2024
1 parent 8b69ccb commit 9144dba
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/api/src/controllers/v0/crawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ export async function crawlController(req: Request, res: Response) {
url,
mode: "single_urls",
crawlerOptions,
scrapeOptions,
internalOptions,
team_id,
plan,
pageOptions: pageOptions,
origin: req.body.origin ?? defaultOrigin,
crawl_id: id,
sitemapped: true,
Expand Down Expand Up @@ -215,6 +216,7 @@ export async function crawlController(req: Request, res: Response) {
{
url,
mode: "single_urls",
crawlerOptions,
scrapeOptions,
internalOptions,
team_id,
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/v0/crawlPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export async function crawlPreviewController(req: Request, res: Response) {
mode: "single_urls",
team_id,
plan: plan!,
crawlerOptions,
scrapeOptions,
internalOptions,
origin: "website-preview",
Expand All @@ -131,6 +132,7 @@ export async function crawlPreviewController(req: Request, res: Response) {
mode: "single_urls",
team_id,
plan: plan!,
crawlerOptions,
scrapeOptions,
internalOptions,
origin: "website-preview",
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/controllers/v1/crawl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export async function crawlController(

const crawlerOptions = {
...req.body,
url: undefined,
scrapeOptions: undefined,
};
const scrapeOptions = req.body.scrapeOptions;
Expand Down Expand Up @@ -147,6 +148,7 @@ export async function crawlController(
url: req.body.url,
mode: "single_urls",
team_id: req.auth.team_id,
crawlerOptions,
scrapeOptions: scrapeOptionsSchema.parse(scrapeOptions),
plan: req.auth.plan!,
origin: "api",
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const logger = winston.createLogger({
format: winston.format.combine(
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.metadata({ fillExcept: ["message", "level", "timestamp"] }),
...(process.env.ENVIRONMENT === "production" && process.env.SENTRY_ENVIRONMENT !== "dev" ? [winston.format.colorize(), logFormat] : []),
...(((process.env.ENV === "production" && process.env.SENTRY_ENVIRONMENT === "dev") || (process.env.ENV !== "production")) ? [winston.format.colorize(), logFormat] : []),
),
}),
],
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface IngestResult {
export interface WebScraperOptions {
url: string;
mode: Mode;
crawlerOptions?: any;
scrapeOptions: ScrapeOptions;
internalOptions?: InternalOptions;
team_id: string;
Expand Down

0 comments on commit 9144dba

Please sign in to comment.