Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Merge branch 'main' into test/load-testing

rafaelsideguide75f4e34d8e3f
diff --cc apps/api/src/scraper/WebScraper/utils/custom/website_params.ts
index 763a8578a,32f5c08b7..a798d05bb
--- a/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts
+++ b/apps/api/src/scraper/WebScraper/utils/custom/website_params.ts
@@@ -122,19 -122,24 +122,39 @@@ export const urlSpecificParams =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
},
},
+ "scrapethissite.com":{
+ defaultScraper: "fetch",
+ headers: {
+ "User-Agent":
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
+ "sec-fetch-site": "same-origin",
+ "sec-fetch-mode": "cors",
+ "sec-fetch-dest": "empty",
+ referer: "https://www.google.com/",
+ "accept-language": "en-US,en;q=0.9",
+ "accept-encoding": "gzip, deflate, br",
+ accept:
+ "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
+ },
++ },
+ "help.salesforce.com":{
+ defaultScraper: "playwright",
+ params: {
+ wait_browser: "networkidle2",
+ block_resources: false,
+ wait: 2000,
+ },
+ headers: {
+ "User-Agent":
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
+ "sec-fetch-site": "same-origin",
+ "sec-fetch-mode": "cors",
+ "sec-fetch-dest": "empty",
+ referer: "https://www.google.com/",
+ "accept-language": "en-US,en;q=0.9",
+ "accept-encoding": "gzip, deflate, br",
+ accept:
+ "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
+ },
}
};
diff --cc apps/api/src/services/rate-limiter.ts
index 8fa3c9327,5bc48c98f..a0db08d0b
--- a/apps/api/src/services/rate-limiter.ts
+++ b/apps/api/src/services/rate-limiter.ts
@@@ -48,57 -52,9 +52,9 @@@ export const testSuiteRateLimiter = ne
});
- export function crawlRateLimit (plan: string){
- if (plan === "standard"){
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "crawl-standard",
- points: MAX_CRAWLS_PER_MINUTE_STANDARD,
- duration: 60, // Duration in seconds
- });
- } else if (plan === "scale"){
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "crawl-scale",
- points: MAX_CRAWLS_PER_MINUTE_SCALE,
- duration: 60, // Duration in seconds
- });
- }
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "crawl-starter",
- points: MAX_CRAWLS_PER_MINUTE_STARTER,
- duration: 60, // Duration in seconds
- });
- }
-
- export function scrapeRateLimit (plan: string){
- if (plan === "standard"){
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "scrape-standard",
- points: MAX_SCRAPES_PER_MINUTE_STANDARD,
- duration: 60, // Duration in seconds
- });
- } else if (plan === "scale"){
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "scrape-scale",
- points: MAX_SCRAPES_PER_MINUTE_SCALE,
- duration: 60, // Duration in seconds
- });
- }
- return new RateLimiterRedis({
- storeClient: redisClient,
- keyPrefix: "scrape-starter",
- points: MAX_SCRAPES_PER_MINUTE_STARTER,
- duration: 60, // Duration in seconds
- });
- }
-
- export function getRateLimiter(mode: RateLimiterMode, token: string){
+ export function getRateLimiter(mode: RateLimiterMode, token: string, plan?: string){
// Special test suite case. TODO: Change this later.
- if (token.includes("5089cefa58")){
+ if (token.includes("57017")){
return testSuiteRateLimiter;
}
switch (mode) {
diff --cc apps/test-suite/package.json
index 9ccb660b0,33aa2cd9a..11c0c0947
--- a/apps/test-suite/package.json
+++ b/apps/test-suite/package.json
@@@ -3,8 -3,9 +3,10 @@@
"version": "1.0.0",
"description": "",
"scripts": {
- "test": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false",
+ "test:suite": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false",
- "test:load": "artillery run load-test.yml"
++ "test:load": "artillery run load-test.yml",
+ "test:scrape": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false --testPathPattern=tests/scrape.test.ts",
+ "test:crawl": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false --testPathPattern=tests/crawl.test.ts"
},
"author": "",
"license": "ISC",