File Results

Back to top

Typification of the file results. Results of this type are rendered in the template.


final class searx.result_types.file.File(title: str = '', content: str = '', img_src: str = '', iframe_src: str = '', audio_src: str = '', thumbnail: str = '', publishedDate: datetime | None = None, pubdate: str = '', length: timedelta | None = None, views: str = '', metadata: str = '', priority: Literal['', 'high', 'low']='', engines: set[str] = <factory>, open_group: bool = False, close_group: bool = False, positions: list[int] = <factory>, score: float = 0, category: str = '', *, template: str = 'file.html', author: str = '', url: str | None = None, engine: str | None = '', parsed_url: ParseResult | None = None, filename: str = '', size: str = '', time: str = '', mimetype: str = '', abstract: str = '', embedded: str = '', mtype: str = '', subtype: str = '')[source] : Bases: MainResult

Class for results of type *file*

filename: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Name of the file.

size: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Size of bytes in human readable notation (`MB` for 1024 \* 1024 Bytes
    file size.)

time: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Indication of a time, such as the date of the last modification or the
    date of creation. This is a simple string, the *date* of which can be freely
    chosen according to the context.

mimetype: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Mimetype/Subtype of the file. For `audio` and `video`, a URL can be
    passed in the [`File.embedded`](#searx.result_types.file.File.embedded) field to embed the referenced media in
    the result. If no value is specified, the MIME type is determined from
    `self.filename` or, alternatively, from `self.embedded` (if either of
    the two values is set).

abstract: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Abstract of the file.

embedded: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   URL of an embedded media type (audio or video) / is collapsible.

mtype: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Used for displaying [`File.embedded`](#searx.result_types.file.File.embedded). Its value is automatically
    populated from the base type of [`File.mimetype`](#searx.result_types.file.File.mimetype), and can be
    explicitly set to enforce e.g. `audio` or `video` when mimetype is
    something like “application/ogg” but its know the content is for example a
    video.

subtype: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
:   Used for displaying [`File.embedded`](#searx.result_types.file.File.embedded). Its value is automatically
    populated from the subtype type of [`File.mimetype`](#searx.result_types.file.File.mimetype), and can be
    explicitly set to enforce a subtype for the [`File.embedded`](#searx.result_types.file.File.embedded)
    element.

Copyright © SearXNG team

Made with Furo

💾 🌐