We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Time duration for piped videos
<!-- PLEASE FILL THESE FIELDS, IT REALLY HELPS THE MAINTAINERS OF SearXNG -->

**Is your feature request related to a problem? Please describe.**
Like piped music feature, it il possible to add time video duration please ?

**Additional context**
With music whe can see Length : 
![final_music](https://github.com/searxng/searxng/assets/55273439/0f0aebe9-281b-49cf-87f5-50dfdb0eceee)

With video we can not see Length : 
![final_video](https://github.com/searxng/searxng/assets/55273439/2c0f73b9-d5dd-40e3-9c8a-59c824699604)

Could you add this feature please ?
Thanks :)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `searx/engines/piped.py`
Content:
```
1 # SPDX-License-Identifier: AGPL-3.0-or-later
2 # lint: pylint
3 """An alternative privacy-friendly YouTube frontend which is efficient by
4 design.  `Piped’s architecture`_ consists of 3 components:
5 
6 - :py:obj:`backend <backend_url>`
7 - :py:obj:`frontend <frontend_url>`
8 - proxy
9 
10 .. _Piped’s architecture: https://docs.piped.video/docs/architecture/
11 
12 Configuration
13 =============
14 
15 The :py:obj:`backend_url` and :py:obj:`frontend_url` has to be set in the engine
16 named `piped` and are used by all piped engines
17 
18 .. code:: yaml
19 
20   - name: piped
21     engine: piped
22     piped_filter: videos
23     ...
24     frontend_url: https://..
25     backend_url:
26       - https://..
27       - https://..
28 
29   - name: piped.music
30     engine: piped
31     network: piped
32     shortcut: ppdm
33     piped_filter: music_songs
34     ...
35 
36 Known Quirks
37 ============
38 
39 The implementation to support :py:obj:`paging <searx.enginelib.Engine.paging>`
40 is based on the *nextpage* method of Piped's REST API / the :py:obj:`frontend
41 API <frontend_url>`.  This feature is *next page driven* and plays well with the
42 :ref:`infinite_scroll <settings ui>` setting in SearXNG but it does not really
43 fit into SearXNG's UI to select a page by number.
44 
45 Implementations
46 ===============
47 """
48 
49 from __future__ import annotations
50 
51 import time
52 import random
53 from urllib.parse import urlencode
54 import datetime
55 from dateutil import parser
56 
57 # about
58 about = {
59     "website": 'https://github.com/TeamPiped/Piped/',
60     "wikidata_id": 'Q107565255',
61     "official_api_documentation": 'https://docs.piped.video/docs/api-documentation/',
62     "use_official_api": True,
63     "require_api_key": False,
64     "results": 'JSON',
65 }
66 
67 # engine dependent config
68 categories = []
69 paging = True
70 
71 # search-url
72 backend_url: list | str = "https://pipedapi.kavin.rocks"
73 """Piped-Backend_: The core component behind Piped.  The value is an URL or a
74 list of URLs.  In the latter case instance will be selected randomly.  For a
75 complete list of official instances see Piped-Instances (`JSON
76 <https://piped-instances.kavin.rocks/>`__)
77 
78 .. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances
79 .. _Piped-Backend: https://github.com/TeamPiped/Piped-Backend
80 
81 """
82 
83 frontend_url: str = "https://piped.video"
84 """Piped-Frontend_: URL to use as link and for embeds.
85 
86 .. _Piped-Frontend: https://github.com/TeamPiped/Piped
87 """
88 
89 piped_filter = 'all'
90 """Content filter ``music_songs`` or ``videos``"""
91 
92 
93 def _backend_url() -> str:
94     from searx.engines import engines  # pylint: disable=import-outside-toplevel
95 
96     url = engines['piped'].backend_url  # type: ignore
97     if isinstance(url, list):
98         url = random.choice(url)
99     return url
100 
101 
102 def _frontend_url() -> str:
103     from searx.engines import engines  # pylint: disable=import-outside-toplevel
104 
105     return engines['piped'].frontend_url  # type: ignore
106 
107 
108 def request(query, params):
109 
110     args = {
111         'q': query,
112         'filter': piped_filter,
113     }
114 
115     path = "/search"
116     if params['pageno'] > 1:
117         # don't use nextpage when user selected to jump back to page 1
118         nextpage = params['engine_data'].get('nextpage')
119         if nextpage:
120             path = "/nextpage/search"
121             args['nextpage'] = nextpage
122 
123     params["url"] = _backend_url() + f"{path}?" + urlencode(args)
124     return params
125 
126 
127 def response(resp):
128     results = []
129 
130     json = resp.json()
131 
132     for result in json["items"]:
133         # note: piped returns -1 for all upload times when filtering for music
134         uploaded = result.get("uploaded", -1)
135 
136         item = {
137             # the api url differs from the frontend, hence use piped.video as default
138             "url": _frontend_url() + result.get("url", ""),
139             "title": result.get("title", ""),
140             "publishedDate": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,
141             "iframe_src": _frontend_url() + '/embed' + result.get("url", ""),
142         }
143 
144         if piped_filter == 'videos':
145             item["template"] = "videos.html"
146             # if the value of shortDescription set, but is None, return empty string
147             item["content"] = result.get("shortDescription", "") or ""
148             item["thumbnail"] = result.get("thumbnail", "")
149 
150         elif piped_filter == 'music_songs':
151             item["template"] = "default.html"
152             item["img_src"] = result.get("thumbnail", "")
153             item["content"] = result.get("uploaderName", "") or ""
154             length = result.get("duration")
155             if length:
156                 item["length"] = datetime.timedelta(seconds=length)
157 
158         results.append(item)
159 
160     results.append(
161         {
162             "engine_data": json["nextpage"],
163             "key": "nextpage",
164         }
165     )
166     return results
167
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/searx/engines/piped.py b/searx/engines/piped.py
--- a/searx/engines/piped.py
+++ b/searx/engines/piped.py
@@ -140,6 +140,9 @@
             "publishedDate": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,
             "iframe_src": _frontend_url() + '/embed' + result.get("url", ""),
         }
+        length = result.get("duration")
+        if length:
+            item["length"] = datetime.timedelta(seconds=length)
 
         if piped_filter == 'videos':
             item["template"] = "videos.html"
@@ -151,9 +154,6 @@
             item["template"] = "default.html"
             item["img_src"] = result.get("thumbnail", "")
             item["content"] = result.get("uploaderName", "") or ""
-            length = result.get("duration")
-            if length:
-                item["length"] = datetime.timedelta(seconds=length)
 
         results.append(item)

{"golden_diff": "diff --git a/searx/engines/piped.py b/searx/engines/piped.py\n--- a/searx/engines/piped.py\n+++ b/searx/engines/piped.py\n@@ -140,6 +140,9 @@\n             \"publishedDate\": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,\n             \"iframe_src\": _frontend_url() + '/embed' + result.get(\"url\", \"\"),\n         }\n+        length = result.get(\"duration\")\n+        if length:\n+            item[\"length\"] = datetime.timedelta(seconds=length)\n \n         if piped_filter == 'videos':\n             item[\"template\"] = \"videos.html\"\n@@ -151,9 +154,6 @@\n             item[\"template\"] = \"default.html\"\n             item[\"img_src\"] = result.get(\"thumbnail\", \"\")\n             item[\"content\"] = result.get(\"uploaderName\", \"\") or \"\"\n-            length = result.get(\"duration\")\n-            if length:\n-                item[\"length\"] = datetime.timedelta(seconds=length)\n \n         results.append(item)\n", "issue": "Time duration for piped videos\n<!-- PLEASE FILL THESE FIELDS, IT REALLY HELPS THE MAINTAINERS OF SearXNG -->\r\n\r\n**Is your feature request related to a problem? Please describe.**\r\nLike piped music feature, it il possible to add time video duration please ?\r\n\r\n**Additional context**\r\nWith music whe can see Length : \r\n![final_music](https://github.com/searxng/searxng/assets/55273439/0f0aebe9-281b-49cf-87f5-50dfdb0eceee)\r\n\r\nWith video we can not see Length : \r\n![final_video](https://github.com/searxng/searxng/assets/55273439/2c0f73b9-d5dd-40e3-9c8a-59c824699604)\r\n\r\nCould you add this feature please ?\r\nThanks :)\r\n\n", "before_files": [{"content": "# SPDX-License-Identifier: AGPL-3.0-or-later\n# lint: pylint\n\"\"\"An alternative privacy-friendly YouTube frontend which is efficient by\ndesign.  `Piped\u2019s architecture`_ consists of 3 components:\n\n- :py:obj:`backend <backend_url>`\n- :py:obj:`frontend <frontend_url>`\n- proxy\n\n.. _Piped\u2019s architecture: https://docs.piped.video/docs/architecture/\n\nConfiguration\n=============\n\nThe :py:obj:`backend_url` and :py:obj:`frontend_url` has to be set in the engine\nnamed `piped` and are used by all piped engines\n\n.. code:: yaml\n\n  - name: piped\n    engine: piped\n    piped_filter: videos\n    ...\n    frontend_url: https://..\n    backend_url:\n      - https://..\n      - https://..\n\n  - name: piped.music\n    engine: piped\n    network: piped\n    shortcut: ppdm\n    piped_filter: music_songs\n    ...\n\nKnown Quirks\n============\n\nThe implementation to support :py:obj:`paging <searx.enginelib.Engine.paging>`\nis based on the *nextpage* method of Piped's REST API / the :py:obj:`frontend\nAPI <frontend_url>`.  This feature is *next page driven* and plays well with the\n:ref:`infinite_scroll <settings ui>` setting in SearXNG but it does not really\nfit into SearXNG's UI to select a page by number.\n\nImplementations\n===============\n\"\"\"\n\nfrom __future__ import annotations\n\nimport time\nimport random\nfrom urllib.parse import urlencode\nimport datetime\nfrom dateutil import parser\n\n# about\nabout = {\n    \"website\": 'https://github.com/TeamPiped/Piped/',\n    \"wikidata_id\": 'Q107565255',\n    \"official_api_documentation\": 'https://docs.piped.video/docs/api-documentation/',\n    \"use_official_api\": True,\n    \"require_api_key\": False,\n    \"results\": 'JSON',\n}\n\n# engine dependent config\ncategories = []\npaging = True\n\n# search-url\nbackend_url: list | str = \"https://pipedapi.kavin.rocks\"\n\"\"\"Piped-Backend_: The core component behind Piped.  The value is an URL or a\nlist of URLs.  In the latter case instance will be selected randomly.  For a\ncomplete list of official instances see Piped-Instances (`JSON\n<https://piped-instances.kavin.rocks/>`__)\n\n.. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances\n.. _Piped-Backend: https://github.com/TeamPiped/Piped-Backend\n\n\"\"\"\n\nfrontend_url: str = \"https://piped.video\"\n\"\"\"Piped-Frontend_: URL to use as link and for embeds.\n\n.. _Piped-Frontend: https://github.com/TeamPiped/Piped\n\"\"\"\n\npiped_filter = 'all'\n\"\"\"Content filter ``music_songs`` or ``videos``\"\"\"\n\n\ndef _backend_url() -> str:\n    from searx.engines import engines  # pylint: disable=import-outside-toplevel\n\n    url = engines['piped'].backend_url  # type: ignore\n    if isinstance(url, list):\n        url = random.choice(url)\n    return url\n\n\ndef _frontend_url() -> str:\n    from searx.engines import engines  # pylint: disable=import-outside-toplevel\n\n    return engines['piped'].frontend_url  # type: ignore\n\n\ndef request(query, params):\n\n    args = {\n        'q': query,\n        'filter': piped_filter,\n    }\n\n    path = \"/search\"\n    if params['pageno'] > 1:\n        # don't use nextpage when user selected to jump back to page 1\n        nextpage = params['engine_data'].get('nextpage')\n        if nextpage:\n            path = \"/nextpage/search\"\n            args['nextpage'] = nextpage\n\n    params[\"url\"] = _backend_url() + f\"{path}?\" + urlencode(args)\n    return params\n\n\ndef response(resp):\n    results = []\n\n    json = resp.json()\n\n    for result in json[\"items\"]:\n        # note: piped returns -1 for all upload times when filtering for music\n        uploaded = result.get(\"uploaded\", -1)\n\n        item = {\n            # the api url differs from the frontend, hence use piped.video as default\n            \"url\": _frontend_url() + result.get(\"url\", \"\"),\n            \"title\": result.get(\"title\", \"\"),\n            \"publishedDate\": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,\n            \"iframe_src\": _frontend_url() + '/embed' + result.get(\"url\", \"\"),\n        }\n\n        if piped_filter == 'videos':\n            item[\"template\"] = \"videos.html\"\n            # if the value of shortDescription set, but is None, return empty string\n            item[\"content\"] = result.get(\"shortDescription\", \"\") or \"\"\n            item[\"thumbnail\"] = result.get(\"thumbnail\", \"\")\n\n        elif piped_filter == 'music_songs':\n            item[\"template\"] = \"default.html\"\n            item[\"img_src\"] = result.get(\"thumbnail\", \"\")\n            item[\"content\"] = result.get(\"uploaderName\", \"\") or \"\"\n            length = result.get(\"duration\")\n            if length:\n                item[\"length\"] = datetime.timedelta(seconds=length)\n\n        results.append(item)\n\n    results.append(\n        {\n            \"engine_data\": json[\"nextpage\"],\n            \"key\": \"nextpage\",\n        }\n    )\n    return results\n", "path": "searx/engines/piped.py"}], "after_files": [{"content": "# SPDX-License-Identifier: AGPL-3.0-or-later\n# lint: pylint\n\"\"\"An alternative privacy-friendly YouTube frontend which is efficient by\ndesign.  `Piped\u2019s architecture`_ consists of 3 components:\n\n- :py:obj:`backend <backend_url>`\n- :py:obj:`frontend <frontend_url>`\n- proxy\n\n.. _Piped\u2019s architecture: https://docs.piped.video/docs/architecture/\n\nConfiguration\n=============\n\nThe :py:obj:`backend_url` and :py:obj:`frontend_url` has to be set in the engine\nnamed `piped` and are used by all piped engines\n\n.. code:: yaml\n\n  - name: piped\n    engine: piped\n    piped_filter: videos\n    ...\n    frontend_url: https://..\n    backend_url:\n      - https://..\n      - https://..\n\n  - name: piped.music\n    engine: piped\n    network: piped\n    shortcut: ppdm\n    piped_filter: music_songs\n    ...\n\nKnown Quirks\n============\n\nThe implementation to support :py:obj:`paging <searx.enginelib.Engine.paging>`\nis based on the *nextpage* method of Piped's REST API / the :py:obj:`frontend\nAPI <frontend_url>`.  This feature is *next page driven* and plays well with the\n:ref:`infinite_scroll <settings ui>` setting in SearXNG but it does not really\nfit into SearXNG's UI to select a page by number.\n\nImplementations\n===============\n\"\"\"\n\nfrom __future__ import annotations\n\nimport time\nimport random\nfrom urllib.parse import urlencode\nimport datetime\nfrom dateutil import parser\n\n# about\nabout = {\n    \"website\": 'https://github.com/TeamPiped/Piped/',\n    \"wikidata_id\": 'Q107565255',\n    \"official_api_documentation\": 'https://docs.piped.video/docs/api-documentation/',\n    \"use_official_api\": True,\n    \"require_api_key\": False,\n    \"results\": 'JSON',\n}\n\n# engine dependent config\ncategories = []\npaging = True\n\n# search-url\nbackend_url: list | str = \"https://pipedapi.kavin.rocks\"\n\"\"\"Piped-Backend_: The core component behind Piped.  The value is an URL or a\nlist of URLs.  In the latter case instance will be selected randomly.  For a\ncomplete list of official instances see Piped-Instances (`JSON\n<https://piped-instances.kavin.rocks/>`__)\n\n.. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances\n.. _Piped-Backend: https://github.com/TeamPiped/Piped-Backend\n\n\"\"\"\n\nfrontend_url: str = \"https://piped.video\"\n\"\"\"Piped-Frontend_: URL to use as link and for embeds.\n\n.. _Piped-Frontend: https://github.com/TeamPiped/Piped\n\"\"\"\n\npiped_filter = 'all'\n\"\"\"Content filter ``music_songs`` or ``videos``\"\"\"\n\n\ndef _backend_url() -> str:\n    from searx.engines import engines  # pylint: disable=import-outside-toplevel\n\n    url = engines['piped'].backend_url  # type: ignore\n    if isinstance(url, list):\n        url = random.choice(url)\n    return url\n\n\ndef _frontend_url() -> str:\n    from searx.engines import engines  # pylint: disable=import-outside-toplevel\n\n    return engines['piped'].frontend_url  # type: ignore\n\n\ndef request(query, params):\n\n    args = {\n        'q': query,\n        'filter': piped_filter,\n    }\n\n    path = \"/search\"\n    if params['pageno'] > 1:\n        # don't use nextpage when user selected to jump back to page 1\n        nextpage = params['engine_data'].get('nextpage')\n        if nextpage:\n            path = \"/nextpage/search\"\n            args['nextpage'] = nextpage\n\n    params[\"url\"] = _backend_url() + f\"{path}?\" + urlencode(args)\n    return params\n\n\ndef response(resp):\n    results = []\n\n    json = resp.json()\n\n    for result in json[\"items\"]:\n        # note: piped returns -1 for all upload times when filtering for music\n        uploaded = result.get(\"uploaded\", -1)\n\n        item = {\n            # the api url differs from the frontend, hence use piped.video as default\n            \"url\": _frontend_url() + result.get(\"url\", \"\"),\n            \"title\": result.get(\"title\", \"\"),\n            \"publishedDate\": parser.parse(time.ctime(uploaded / 1000)) if uploaded != -1 else None,\n            \"iframe_src\": _frontend_url() + '/embed' + result.get(\"url\", \"\"),\n        }\n        length = result.get(\"duration\")\n        if length:\n            item[\"length\"] = datetime.timedelta(seconds=length)\n\n        if piped_filter == 'videos':\n            item[\"template\"] = \"videos.html\"\n            # if the value of shortDescription set, but is None, return empty string\n            item[\"content\"] = result.get(\"shortDescription\", \"\") or \"\"\n            item[\"thumbnail\"] = result.get(\"thumbnail\", \"\")\n\n        elif piped_filter == 'music_songs':\n            item[\"template\"] = \"default.html\"\n            item[\"img_src\"] = result.get(\"thumbnail\", \"\")\n            item[\"content\"] = result.get(\"uploaderName\", \"\") or \"\"\n\n        results.append(item)\n\n    results.append(\n        {\n            \"engine_data\": json[\"nextpage\"],\n            \"key\": \"nextpage\",\n        }\n    )\n    return results\n", "path": "searx/engines/piped.py"}]}