Skip to content

Clause and Variable list

rudolphos edited this page Dec 25, 2024 · 2 revisions

Clauses

Clauses are only used in rule definitions for routing and renaming to determine if a download should be renamed or routed.

Output and Capture

into: :fileext:/foo [Required] Routes downloads to, or rewrites download filenames into the given pattern
capture: pageurl pageurl,sourceurl [Optional] Selects the matcher for regex capture group variables ( :$1:, :$2:…). Split multiple capture targets with a ,.

Matchers

Matcher clauses use regular expression strings.

context: page Matches what is clicked { media, link, selection, page, click, tab (Firefox)}
menuindex: 1 Matches the menu index of the clicked menu item (1, 2, 3…)
comment: a menu item comment Matches the comment of the clicked menu item
fileext: jpg Matches the file extension
filename: actual_filename.jpg Matches the final filename
frameurl: http://www.google.com Matches the URL of the current frame
linktext: Click here to download [Firefox] Matches the link text or element title attribute
mediatype: image Matches the media type: audio, video, or image
naivefilename: cat.jpg Matches the naive filename
pagedomain: xyz.com Matches the page hostname
pagetitle: Welcome to my page! Matches the current page title
pageurl: http://www.google.com Matches the current page URL
selectiontext: "X-Cops" is the twelfth Matches the selection text
sourcedomain: cdn.xyz.com Matches the source hostname for media
sourceurl: http://cdn.xyz.com/pic.jpg Matches the source URL for media

Variables

Variables are used in directory and path patterns.

Standard

Usable everywhere

:date: 2000-01-01 Current date
:isodate: 20170123T123040Z Current datetime as a UTC ISO8601 string
:unixdate: 946684800 Current datetime as a Unix timestamp
:year: 2000 Current year
:month: 01 Current month
:day: 24 Current day of month
:hour: 13 Current hour (24-hour)
:minute: 46 Current minute
:second: 05 Current second
:pageurl: https://xyz.com/abc URL of the page
:sourcedomain: cdn.xyz.com Hostname of the source
:sourceurl: http://xyz.com/pic.jpg URL of the source
:pagedomain: xyz.com Hostname of the page
:pagetitle: My Webpage Title! Title of the page
:linktext: Direct link to image [Firefox] Text of the link, or title attribute of element
:selectiontext: A swan created using The currently selected text on the page
:naivefilename: file.jpg The naive filename (URL-based). Use the routing feature if this fails.
:naivefileext: jpg The naive file (URL-based). Use the routing feature if this fails.

Routing and Filenames Only

Only usable when routing and rewriting filenames

:filename: my_image.jpg Full actual filename (after Content-Disposition)
:fileext: jpg File extension, if available
:$1:, :$2: Capture group where 1 = the n th capture group

Decorative

Only usable in menu items

--- Creates a separator in the context menu