File Saving
๐ File Saving
ScrapeSome allows you to format and save your scraped content with zero hassleโboth via the CLI and in Python code.
๐ป Save Output to File
Use these flags to save your output directly from the command line:
--save-to-fileor-s: Enable saving to a file--file-nameor-n: Desired filename (extension added automatically)--output-formator-f: One ofhtml,text,markdown, orjson
โ ๏ธ Note: When saving to a file, only one URL can be scraped at a time.
๐ฆ Example:
scrapesome scrape --url "https://example.com" --output-format markdown --save-to-file --file-name output
๐ This saves the result as output.md.
Save Output in Code
The sync_scraper function supports saving to file using two optional flags:
save_to_file=True: Enables savingfile_name="your_file_name": Sets the base filename (extension inferred from format)
The output will be returned as a dictionary:
{
"data": "<formatted content>",
"file": "your_file_name.<ext>" # if saving is enabled
}
๐ Example:
result = sync_scraper(url="https://example.com", output_format_type="json", save_to_file=True, file_name="example_output")
print(f"Saved output to {result.get('file')}")
Now you're set to save clean, readable data in your preferred formatโprogrammatically or from the CLI.