Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(api): check request country (#2012)
Gergő Móriczcadfd218296c
diff --git a/apps/api/package.json b/apps/api/package.jsonindex 4649bfaa7..6f1ddfe91 100644--- a/apps/api/package.json+++ b/apps/api/package.json@@ -108,6 +108,7 @@"express": "^4.21.2","express-rate-limit": "^7.3.1","express-ws": "^5.0.2",+ "geoip-country": "^5.0.202508192342","git-diff": "^2.0.6","glob": "^10.4.2","gpt3-tokenizer": "^1.1.5",diff --git a/apps/api/pnpm-lock.yaml b/apps/api/pnpm-lock.yamlindex 0891876a0..35aa7d735 100644--- a/apps/api/pnpm-lock.yaml+++ b/apps/api/pnpm-lock.yaml@@ -167,6 +167,9 @@ importers:express-ws:specifier: ^5.0.2+ geoip-country:+ specifier: ^5.0.202508192342+ version: 5.0.202508192342git-diff:specifier: ^2.0.6version: 2.0.6@@ -3086,6 +3089,9 @@ packages:resolution: {integrity: sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==}+ resolution: {integrity: sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==}+resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}@@ -3213,6 +3219,9 @@ packages:resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==}+ resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}+resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==}@@ -3425,6 +3434,9 @@ packages:resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}engines: {node: '>= 0.10'}+ resolution: {integrity: sha512-nPklKJ5qtmY5MdBKw1NiBAoyx5Sa7p2yPpljZyQ7gyCN1m+eMFs9I6CT37Mxt8zvR5L3VzD3DJBE4WQzX3WF4A==}+resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==}engines: {node: '>=0.8'}@@ -3890,6 +3902,9 @@ packages:resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==}+ resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==}+resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==}@@ -4006,6 +4021,10 @@ packages:resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}engines: {node: '>=6.9.0'}+ resolution: {integrity: sha512-aezJJvZEACWX9tbB4jo5wNzh/HtSNM5YdRjc3RjBFdLdmBd9UO25CqCfbNaKU4uk3L9Wct6Ra8mqsbfGOUM0UQ==}+ engines: {node: '>=10.20.0'}+resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}engines: {node: 6.* || 8.* || >= 10.*}@@ -4222,6 +4241,10 @@ packages:resolution: {integrity: sha512-NWv9YLW4PoW2B7xtzaS3NCot75m6nK7Icdv0o3lfMceJVRfSoQwqD4wEH5rLwoKJwUiZ/rfpiVBhnaF0FK4HoA==}engines: {node: '>= 12'}+ resolution: {integrity: sha512-c5uxc2WUTuRBVHT/6r4m7HIr/DfV0bF6DvLH3iZGSK8wp8iMwwZSgIq2do0asFf8q9ECug0SE+6+1ACMe4sorA==}+ engines: {node: '>= 0.10'}+resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==}engines: {node: '>= 0.10'}@@ -4510,6 +4533,9 @@ packages:resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}hasBin: true+ resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==}+resolution: {integrity: sha512-BZYDGVAIriBWTpIxYzrXjv3E/4u8+/pSG5bQdIYCbNCGOvsPkDQfTVLAIXAf9ETdCpduCVTkDe2NNZ8NIwUVzw==}engines: {node: '>=18'}@@ -4640,12 +4666,27 @@ packages:resolution: {integrity: sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==}+ resolution: {integrity: sha512-yaRZoAV3Xq28F1iafWN1+a0rflOej93l1DQUejs3SZ41h2O9UJBoS9aueGjPDgAl4B6tPC0NuuchLKaDQQ3Isg==}+resolution: {integrity: sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==}+ resolution: {integrity: sha512-iykTDTb7PK33HSQmKy34zv+hh4WEu7WonJPXQcgODzUbbtradtNs8RsD/GI7XV++60KaKR1xhW56N4ISqHesfQ==}+resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}+ resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}++ resolution: {integrity: sha512-sW73O6S8+Tg66eY56DBk85aQzzUJDtpoXFBgELMd5P/SotAguo+1kYO6RuYgXxA4HJH3LFTFPASX6ET6bjfriw==}++ resolution: {integrity: sha512-eWsgQW89IewS95ZOcr15HHCX6FVDxq3f2PNUIng3fyzsPev9imFQxIYdFZ6crl8L56UR6ZlGDLcEb3RZsCSSqw==}+resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}@@ -5087,6 +5128,9 @@ packages:resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==}+ resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==}+resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}engines: {node: '>=4.0.0'}@@ -5567,6 +5611,9 @@ packages:resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}+ resolution: {integrity: sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==}+resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==}@@ -6278,6 +6325,9 @@ packages:resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}engines: {node: '>=12'}+ resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==}+resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}engines: {node: '>=6'}@@ -10153,17 +10203,17 @@ snapshots:dependencies:'@types/yargs-parser': 21.0.3- '@wagmi/[email protected](@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected])':+ '@wagmi/[email protected](@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected])':dependencies:'@base-org/account': 1.1.1([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])'@coinbase/wallet-sdk': 4.3.6([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])'@safe-global/safe-apps-provider': 0.18.6([email protected])([email protected])([email protected])([email protected])'@safe-global/safe-apps-sdk': 9.1.0([email protected])([email protected])([email protected])([email protected])- '@wagmi/core': 2.18.1(@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))+ '@wagmi/core': 2.18.1(@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))'@walletconnect/ethereum-provider': 2.21.1([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])cbw-sdk: '@coinbase/[email protected]'optionalDependencies:typescript: 5.8.3transitivePeerDependencies:@@ -10195,11 +10245,11 @@ snapshots:- utf-8-validate- zod- '@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))':+ '@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))':dependencies:eventemitter3: 5.0.1mipd: 0.0.7([email protected])optionalDependencies:'@tanstack/query-core': 5.83.1@@ -10749,6 +10799,11 @@ snapshots:typescript: 5.8.3zod: 3.22.4+ optionalDependencies:+ typescript: 5.8.3+ zod: 3.24.2+optionalDependencies:typescript: 5.8.3@@ -10857,6 +10912,10 @@ snapshots:dependencies:retry: 0.13.1+ dependencies:+ lodash: 4.17.21+@@ -11030,6 +11089,8 @@ snapshots:dependencies:node-int64: 0.4.0+ [email protected]: {}+@@ -11259,6 +11320,8 @@ snapshots:object-assign: 4.1.1vary: 1.1.2+ [email protected]: {}+[email protected](@types/[email protected])([email protected](@types/[email protected])([email protected])):@@ -11753,6 +11816,10 @@ snapshots:dependencies:bser: 2.1.1+ dependencies:+ pend: 1.2.0+@@ -11878,6 +11945,13 @@ snapshots:+ dependencies:+ async: 2.6.4+ countries-list: 3.1.1+ ip-address: 6.4.0+ yauzl: 2.10.0+@@ -12147,6 +12221,16 @@ snapshots:+ dependencies:+ jsbn: 1.1.0+ lodash.find: 4.6.0+ lodash.max: 4.0.1+ lodash.merge: 4.6.2+ lodash.padstart: 4.6.1+ lodash.repeat: 4.1.0+ sprintf-js: 1.1.2+@@ -12642,6 +12726,8 @@ snapshots:dependencies:argparse: 2.0.1+ [email protected]: {}+dependencies:cssstyle: 4.2.1@@ -12785,10 +12871,20 @@ snapshots:+ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+@@ -13123,6 +13219,21 @@ snapshots:transitivePeerDependencies:- zod+ dependencies:+ '@adraffy/ens-normalize': 1.11.0+ '@noble/ciphers': 1.3.0+ '@noble/curves': 1.9.6+ '@noble/hashes': 1.8.0+ '@scure/bip32': 1.7.0+ '@scure/bip39': 1.6.0+ abitype: 1.0.8([email protected])([email protected])+ eventemitter3: 5.0.1+ optionalDependencies:+ typescript: 5.8.3+ transitivePeerDependencies:+ - zod+dependencies:'@adraffy/ens-normalize': 1.11.0@@ -13222,6 +13333,8 @@ snapshots:+ [email protected]: {}+@@ -13731,6 +13844,8 @@ snapshots:+ [email protected]: {}+@@ -14168,6 +14283,23 @@ snapshots:- utf-8-validate- zod+ dependencies:+ '@noble/curves': 1.9.2+ '@noble/hashes': 1.8.0+ '@scure/bip32': 1.7.0+ '@scure/bip39': 1.6.0+ abitype: 1.0.8([email protected])([email protected])+ ox: 0.8.6([email protected])([email protected])+ ws: 8.18.2([email protected])([email protected])+ optionalDependencies:+ typescript: 5.8.3+ transitivePeerDependencies:+ - bufferutil+ - utf-8-validate+ - zod+dependencies:'@noble/curves': 1.9.2@@ -14192,11 +14324,11 @@ snapshots:[email protected](@tanstack/[email protected])(@tanstack/[email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected]):dependencies:'@tanstack/react-query': 5.84.1([email protected])- '@wagmi/connectors': 5.9.1(@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected])- '@wagmi/core': 2.18.1(@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))+ '@wagmi/connectors': 5.9.1(@wagmi/[email protected](@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected])+ '@wagmi/core': 2.18.1(@tanstack/[email protected])([email protected])([email protected])([email protected]([email protected]))([email protected]([email protected])([email protected])([email protected])([email protected]))react: 18.3.1use-sync-external-store: 1.4.0([email protected])optionalDependencies:typescript: 5.8.3transitivePeerDependencies:@@ -14399,7 +14531,7 @@ snapshots:[email protected](@tanstack/[email protected])(@tanstack/[email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:wagmi: 2.16.1(@tanstack/[email protected])(@tanstack/[email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]([email protected])([email protected])([email protected])([email protected]))([email protected])zod: 3.25.76transitivePeerDependencies:@@ -14488,6 +14620,11 @@ snapshots:y18n: 5.0.8yargs-parser: 21.1.1+ dependencies:+ buffer-crc32: 0.2.13+ fd-slicer: 1.1.0+diff --git a/apps/api/src/routes/shared.ts b/apps/api/src/routes/shared.tsindex 4a4eb4178..7877c2963 100644--- a/apps/api/src/routes/shared.ts+++ b/apps/api/src/routes/shared.ts@@ -15,6 +15,7 @@ import { isUrlBlocked } from "../scraper/WebScraper/utils/blocklist";import { logger } from "../lib/logger";import { BLOCKLISTED_URL_MESSAGE } from "../lib/strings";import { addDomainFrequencyJob } from "../services";+import * as geoip from "geoip-country";export function checkCreditsMiddleware(_minimum?: number,@@ -178,6 +179,55 @@ export function blocklistMiddleware(next();}+export function countryCheck(+ req: RequestWithAuth<any, any, any>,+ res: Response,+ next: NextFunction+) {+ const couldBeRestricted = req.body+ && (+ req.body.actions+ || (req.body.headers && typeof req.body.headers === "object" && Object.keys(req.body.headers).length > 0)+ || req.body.agent+ || req.body.jsonOptions?.agent+ || req.body.extract?.agent+ || req.body.scrapeOptions?.actions+ || (req.body.scrapeOptions?.headers && typeof req.body.scrapeOptions.headers === "object" && Object.keys(req.body.scrapeOptions.headers).length > 0)+ || req.body.scrapeOptions?.agent+ || req.body.scrapeOptions?.jsonOptions?.agent+ || req.body.scrapeOptions?.extract?.agent+ );++ if (!couldBeRestricted) {+ return next();+ }++ const _ip = req.headers["x-forwarded-for"] || req.socket.remoteAddress || "";+ const ip = Array.isArray(_ip) ? _ip[0] : _ip.split(",")[0];++ if (!ip) {+ logger.warn("IP address not found, unable to check country");+ return next();+ }++ const country = geoip.lookup(ip);+ if (!country || !country.country) {+ logger.warn("IP address country data not found", { ip });+ return next();+ }++ const restricted = process.env.RESTRICTED_COUNTRIES?.split(",") ?? [];+ if (restricted.includes(country.country)) {+ logger.warn("Denied access to restricted country", { ip, country: country.country, teamId: req.auth.team_id });+ return res.status(403).json({+ success: false,+ error: "Use of headers, actions, and the FIRE-1 agent is not allowed by default in your country. Please contact us at [email protected]",+ });+ }++ next();+}+export function wrap(controller: (req: Request, res: Response) => Promise<any>,): (req: Request, res: Response, next: NextFunction) => any {diff --git a/apps/api/src/routes/v1.ts b/apps/api/src/routes/v1.tsindex 3b3dd80c6..018ad304d 100644--- a/apps/api/src/routes/v1.ts+++ b/apps/api/src/routes/v1.ts@@ -28,6 +28,7 @@ import {authMiddleware,checkCreditsMiddleware,blocklistMiddleware,+ countryCheck,idempotencyMiddleware,wrap,} from "./shared";@@ -60,6 +61,7 @@ v1Router.use(v1Router.post("/scrape",authMiddleware(RateLimiterMode.Scrape),+ countryCheck,checkCreditsMiddleware(1),blocklistMiddleware,wrap(scrapeController),@@ -68,6 +70,7 @@ v1Router.post(v1Router.post("/crawl",authMiddleware(RateLimiterMode.Crawl),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,idempotencyMiddleware,@@ -77,6 +80,7 @@ v1Router.post(v1Router.post("/batch/scrape",authMiddleware(RateLimiterMode.Scrape),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,idempotencyMiddleware,@@ -86,6 +90,7 @@ v1Router.post(v1Router.post("/search",authMiddleware(RateLimiterMode.Search),+ countryCheck,checkCreditsMiddleware(),wrap(searchController),);@@ -153,6 +158,7 @@ v1Router.ws("/crawl/:jobId", crawlStatusWSController);v1Router.post("/extract",authMiddleware(RateLimiterMode.Extract),+ countryCheck,checkCreditsMiddleware(1),wrap(extractController),);@@ -166,6 +172,7 @@ v1Router.get(v1Router.post("/llmstxt",authMiddleware(RateLimiterMode.Scrape),+ countryCheck,blocklistMiddleware,wrap(generateLLMsTextController),);@@ -179,6 +186,7 @@ v1Router.get(v1Router.post("/deep-research",authMiddleware(RateLimiterMode.Crawl),+ countryCheck,checkCreditsMiddleware(1),wrap(deepResearchController),);@@ -229,5 +237,6 @@ v1Router.get(v1Router.post("/x402/search",authMiddleware(RateLimiterMode.Search),+ countryCheck,wrap(x402SearchController),);\ No newline at end of filediff --git a/apps/api/src/routes/v2.ts b/apps/api/src/routes/v2.tsindex 192e9208d..35b90a52d 100644--- a/apps/api/src/routes/v2.ts+++ b/apps/api/src/routes/v2.ts@@ -22,6 +22,7 @@ import {authMiddleware,checkCreditsMiddleware,blocklistMiddleware,+ countryCheck,idempotencyMiddleware,wrap,} from "./shared";@@ -33,6 +34,7 @@ export const v2Router = express.Router();v2Router.post("/search",authMiddleware(RateLimiterMode.Search),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,wrap(searchController),@@ -41,6 +43,7 @@ v2Router.post(v2Router.post("/scrape",authMiddleware(RateLimiterMode.Scrape),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,wrap(scrapeController),@@ -55,6 +58,7 @@ v2Router.get(v2Router.post("/batch/scrape",authMiddleware(RateLimiterMode.Scrape),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,wrap(batchScrapeController),@@ -71,6 +75,7 @@ v2Router.post(v2Router.post("/crawl",authMiddleware(RateLimiterMode.Crawl),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,idempotencyMiddleware,@@ -131,6 +136,7 @@ v2Router.get(v2Router.post("/extract",authMiddleware(RateLimiterMode.Extract),+ countryCheck,checkCreditsMiddleware(),blocklistMiddleware,wrap(extractController),