# Scripts

{% hint style="danger" %}
All files must end with a .py to be auto-detected  by OF-Scraper as a python file
{% endhint %}

## Naming Scripts

These scripts would be place into the naming\_script section of the config

### rename jpeg to jpg

```
import sys
import json
import pathlib
def main():
    input_json_str = sys.stdin.read()

    # 1. Parse the JSON string into a Python dictionary
    data = json.loads(input_json_str)
    #2  Fix name
    dir=data["dir"]
    file=data["file"].replace("jpeg","jpg").strip()
    filename=str(pathlib.Path(dir,file))
    #2. Print to stdout for output
    print(filename, file=sys.stdout)
    #3. Print all information data to stderr
    print(filename, file=sys.stderr)
if __name__=="__main__":
    main()


```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://of-scraper.gitbook.io/of-scraper/using-the-scraper/scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
