OF-Scraper
  • Welcome
  • Requirements
  • Install
    • Pre-Install Guides
      • Linux
      • Windows
      • Mac
    • PIPX Install
    • PIP Install
    • Binary Releases
    • Docker
    • Release Info
    • Managing Multiple Python Versions
  • Getting Started and Settings
    • Config Options
      • Config Location
      • General Options
      • File Output Options
        • Placeholders
        • Responsetype Placeholders
      • Download Options
        • Download Toggles
        • Media Filtering Options
        • Advanced Download Options
      • Setting metadata path
      • Binaries Options
      • CDM Options
      • Performance Options
        • Values to Pick
      • Script Options
      • Advanced config options
        • Changing Const Values
        • Mediatype overwrites
    • Depreciated Options
    • Auth
    • Controlling Output/Logs
    • Migrating from Digitalcriminal's script
  • Using the Scraper
    • Using Prompts
      • Old Menu
      • Page 2
    • Username selection or Fuzzy Search
    • Basic Automation with command-line
      • Basic Actions
        • Liking/Unliking Post
        • Downloading Content
          • Downloading Text Files
          • Downloading Purchases From Deleted Models
        • Multiple Actions
      • Model Filtering/Sorting
        • Price Filtering/Sort
      • Advanced Args
      • Scripting tips
      • Enable label scan
    • Recipes
      • Adding Proxy
      • Redownload Deleted Downloads
  • Content Check Modes
    • Table Columns
    • Table Management
      • Pre 3.10.7 filtering
  • Scraping Individual Posts or Media
  • Metadata
    • Schema
    • Creating Metadata
    • Metadata location
  • CDM Setup
    • CDM issues
  • FAQ/Common Issues
    • Page 1
  • Command Reference
    • Shared Options
      • General Program Options
        • Program Options
        • Logging Options
        • Filename Modification Options
        • Media Filters Options
        • Download Options
        • Advanced Program Options
      • Shared Scrape and Metadata Check Mode Options
        • User List Filter Options
          • Advanced User Filters
        • User Selection Options
        • Model Sorting & Processing Options
        • Content Options
        • Automation Options
        • Advanced Search & Processing Options
    • Main Scraper Options
    • Metadata Check Mode Options
    • Content Check Modes Options
    • Manual Mode Options
  • Request Change to Doc
  • Testing
Powered by GitBook
On this page
  • code-execution
  • custom_values
  • How it works
  • Example
  • Changing const
  • dynamic-mode-default
  • cache-mode
  • rotate_logs
  • sanitize_text
  • downloadbars
  • temp_dir
  • infinite_loop_action_mode
  • logs_expire_time
  • ssl_validation:
  • enable_auto_after
  • remove_hash_match
  • default_user_list
  • default_black_list
  1. Getting Started and Settings
  2. Config Options

Advanced config options

code-execution

The 'code-execution' feature enables code execution during the generation of metadata, path, file_format, and dir_format.

All available placeholders can be used within these options, and the input for these choices will be transformed into an f-string for processing. As an example

eval("f'{}'".format(config_.get_dirformat(config_.read_config())))

Any Python code that produces a string as its output should work just fine in this context.


custom_values

Before, 'custom' was transformed into a dictionary using Python's built-in JSON library.

While this approach remains an option, OF-Scraper now supports scripting within the 'custom' block, allowing for the inclusion of small scripts directly.

How it works

Use exec if you need to save a variable the keys should be executed in order

```python
            if not isinstance(custom,dict)==True:
                try:return eval(custom)
                except:return custom
            for key,val in custom.items():
                try:custom[key]=eval(val)
                except:continue
```

Each value in dictionary is ran through eval, meaning each value should be a statement that equals some value

You can access the calculated value via

custom.get(key)

Example

code-execution:true
dir_format:{custom.get(model_username,model_username)}
custom={"mymodel","'replace'.lower()"}

It's crucial to note that when working with strings, the inner quotes hold significance because 'eval' interprets what's inside the quotes as code.

Therefore, maintaining the inner quotes is vital for accurate interpretation by 'eval'.

Changing const

You can change most const values with the custom dict as well


dynamic-mode-default

  • This is utilized to sign a request, essential for its authorization. Without this, the request would lack proper authorization and fail.

  • Generally, the options remain mostly identical. However, in rare instances, modifying these options might resolve certain issues with authentication


cache-mode

You can use --no-cache

or --no-cache-api

If your having major issues with cache

Options JSON SQLITE None (to disable)

The script uses DiskCache, which has different options like SQLite and JSON.

For most folks, SQLite works fine, but if you're on a network drive, its performance might not be great. That's when switching to JSON could be a smart move, according to the author


rotate_logs

If set to True, each run will generate a new log. If set to False, each logs will be combined into one file per day.

sanitize_text

If set to true, text content will be sanitized before to database insertion into database

downloadbars

whether to show download progress bars or not

Disabling these can improve performance


temp_dir

If not set the the final download directory is used to hold temp files

This overrides the temporary directory used during download

infinite_loop_action_mode

You can disable the prompt for continuing the script with any arguments by setting the const value CONTINUE_BOOL = False

Sets the script to run in a infinite loop even when --action is used

logs_expire_time

Logs older than the specified time will be deleted from the system. Log rotation must be enabled, and the value must be greater than 0.

ssl_validation:

Disable validation of ssl certificates


enable_auto_after

  • dynamically sets after if enabled

    1. after is set to zero for the first run following that --after was used previously and has been removed in a future run

    2. dynamically sets after based on db status

  • if disabled after is is set based on --after only

    1. if --after is None, then after will be set as 0


remove_hash_match

Set value to None to disable calculating hash, False will calculate but not remove files

hashes are 128 bit and matched with file sizes to ensure uniqueness

If at least two files with identical hashes exist on the system, remove duplicate files identified by those hashes, keeping only one copy on the file system


ofscraper.main or main are the default built in key words for a list combining active and expired list

ofscraper.active or active are the default built in key words for active list

ofscraper.expired or expired are the default built in key words for expired list

default_user_list

If blank then ofscraper.main is used as setting

The default user list used during username scan

default_black_list

If blank then the black list option is disabled

The default black list used during username scan

PreviousScript OptionsNextChanging Const Values

Last updated 19 days ago

Changing Const Values
DiskCache Tutorial — DiskCache 5.6.1 documentation
Logo