Smartnaming & smartrules
The smartnaming file describes how the filename of a video is constructed.
This file follows the TOML format.
Here is a valid file:
# Default rule max_length = 64 template = '%title' [[rule]] # First rule - only for pages hosted under foo.com domain url = 'foo.com' template = 'foobar-%title' # Filename template # Will save file Downloads/foo/ directory - on available in 10.0.286 and above. directory = 'foo' [[rule]] # Second rule - only for pages hosted under bar.com domain url = 'bar.com' max_length = 99 template = '%title-%hostname-%selector' selector = 'h2.title' # Etc. Add as many rules as you want.
The first part is the default rules for all websites. You can set the max_length and the template . VDH use the value template of template to create file. If template is myvideo , then all video files will be named myvideo.mp4 . If template is myvideo-%title , video files will named myvideo-title-of-webpage.mp4 . You can see that the default value is juste the title of the page with a maximum size of 64 characters.
The second part is made of [[rule]] blocks. Each block can define:
max_lengthis the maximum filename sizetemplateis the format of the filename. This can include 3 components:%titleis replaced with the page title%hostnameis replaced with the url hostname%selectoris replaced with the matching selector (see below)
urlis the URL of the origin of the download.selectoris a CSS selector that will be run against the video page
One rule starts with [[rule]] .
The priority of a rule is defined by its position in the file. Top rules have higher priorities.
Advanced
For document title
you can add force_doc_title = true to bypass the meta title tag detection (use document.title instead of og:title ).
replace mode
Within a rule, you can add a "replace" section:
replace = [
{ from = 'foo', to = 'bar' }
]
This will replace the work foo with bar .
This supports regular expressions:
replace = [
{ from = '\.([^\s]+)', to = 'dot $1' }
]
Please note, for regular expressions, that you need to use single quotes (' not " ).