Skip to content

Commit 41c89d6

Browse files
committed
fixes
1 parent c186cdc commit 41c89d6

File tree

9 files changed

+649
-545
lines changed

9 files changed

+649
-545
lines changed

botasaurus-controls/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const parseBoolean = (value:any) => {
248248
return true;
249249
}
250250
}
251-
return value;
251+
return null
252252
}
253253
const parseNumber = (value:any)=>{
254254
if (typeof value === 'string') {

botasaurus/cache.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def get_files_without_json_extension(directory_path):
117117
files_without_json_extension = [file.rstrip('.json') for file in files]
118118

119119
return files_without_json_extension
120+
120121
def is_affirmative(input_string):
121122
# List of affirmative representations
122123
affirmative_values = {"true", "yes", "y", "1", "yeah", "yep", "sure", "ok", "okay", "affirmative", "t"}

js/botasaurus-desktop-api/botasaurus-desktop-api-docs/src/app/components/ApiIntegrationComponent/createApiREADME.tsx

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,50 @@ function filtersToJsObjectString(filters: any[], indent: number = defaultIndenta
9090
const formattedString = `{\n` + entries.join('\n') + `\n${bracketsIndentationStr}}`
9191
return formattedString
9292
}
93+
94+
function createCachingText(enable_cache: boolean): string {
95+
if (enable_cache) {
96+
return `## Caching
97+
98+
The API automatically **caches** results to minimize redundant scraping. This means:
99+
- Scraper results are stored based on input data
100+
- Subsequent requests with the same input data return cached data instantly
101+
102+
### Changing Cache Settings
103+
104+
You can change this caching behavior when initializing the API client:
105+
106+
\`\`\`typescript
107+
// Option 1: Disable caching for fresh results
108+
const api = new Api({ enableCache: false })
109+
110+
// Option 2: Keep caching enabled (default)
111+
const api = new Api({ enableCache: true })
112+
\`\`\``;
113+
} else {
114+
return `## Caching
115+
116+
The API does not **cache results**, so you get fresh results on every request.
117+
118+
### Changing Cache Settings
119+
120+
You can change this caching behavior when initializing the API client:
121+
122+
\`\`\`typescript
123+
// Option 1: Enable caching to improve performance
124+
const api = new Api({ enableCache: true })
125+
126+
// Option 2: Keep caching disabled for fresh results (default)
127+
const api = new Api({ enableCache: false })
128+
\`\`\`
129+
130+
When caching is enabled:
131+
- Scraper results are stored based on input data
132+
- Subsequent requests with the same input data return cached data instantly`;
133+
}
134+
135+
}
136+
93137
function createApiTaskText(scraperName: string, hasSingleScraper: boolean, defaultData: any, maxRunsMessage): string {
94138
const x = hasSingleScraper ? '' : `scraperName: '${scraperName}', `
95139

@@ -418,7 +462,7 @@ This will:
418462
- Make a **GET** request to the \`${final[0]}\` endpoint.
419463
- Execute the scraper immediately, bypassing task creation, scheduling, and running overhead.
420464
- Validate input data before execution, returning a \`400\` error for invalid requests.
421-
${enable_cache ? '- Cache the results based on the provided parameters.\n' : ''}- ${maxRunsMessage2}
465+
${enable_cache ? '- Cache the results based on the provided input data.\n' : ''}- ${maxRunsMessage2}
422466
423467
This method is especially useful when:
424468
@@ -482,6 +526,8 @@ async function main() {
482526
main()
483527
\`\`\`
484528
529+
${createCachingText(enable_cache)}
530+
485531
## That's It!
486532
487533
Now, go and build something awesome.`

0 commit comments

Comments
 (0)