2 Commits

Author SHA1 Message Date
Hu Butui
da6ab39049 [fix] iqiyi: Add support for multiple videos per album
Add support for albums containing multiple videos in iqiyi engine. When
albumInfo contains a "videos" list, process each video individually to
create separate search results for each episode/video instead of a single
result for the entire album.

Also get video length from `duration` instead of `subscriptContent`.

Signed-off-by: Hu Butui <hot123tea123@gmail.com>
2026-01-26 19:46:05 +01:00
Austin-Olacsi
5271c3b9e1 [fix] pixiv: update pixiv proxy docs URL in settings.yml 2026-01-26 19:31:10 +01:00
2 changed files with 32 additions and 24 deletions

View File

@@ -1,11 +1,12 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
"""iQiyi: A search engine for retrieving videos from iQiyi.""" """iQiyi: A search engine for retrieving videos from iQiyi."""
import typing
from urllib.parse import urlencode from urllib.parse import urlencode
from datetime import datetime from datetime import datetime, timedelta
from searx.exceptions import SearxEngineAPIException from searx.exceptions import SearxEngineAPIException
from searx.utils import parse_duration_string
about = { about = {
"website": "https://www.iqiyi.com/", "website": "https://www.iqiyi.com/",
@@ -35,6 +36,28 @@ def request(query, params):
return params return params
def _result(video: dict[str, typing.Any], album_info: dict[str, typing.Any]):
length = timedelta(milliseconds=video.get("duration", 0))
published_date = None
release_time = album_info.get("releaseTime", {}).get("value")
if release_time:
try:
published_date = datetime.strptime(release_time, "%Y-%m-%d")
except (ValueError, TypeError):
pass
return {
'url': video.get("pageUrl", "").replace("http://", "https://"),
'title': video.get("title", ""),
'content': album_info.get("brief", {}).get("value", ""),
'template': 'videos.html',
'length': length,
'publishedDate': published_date,
'thumbnail': album_info.get("img", ""),
}
def response(resp): def response(resp):
try: try:
data = resp.json() data = resp.json()
@@ -47,26 +70,11 @@ def response(resp):
for entry in data["data"]["templates"]: for entry in data["data"]["templates"]:
album_info = entry.get("albumInfo", {}) album_info = entry.get("albumInfo", {})
if "videos" in album_info:
published_date = None for video in album_info["videos"]:
release_time = album_info.get("releaseTime", {}).get("value") results.append(_result(video, album_info))
if release_time: else:
try: # album only contains a single video
published_date = datetime.strptime(release_time, "%Y-%m-%d") results.append(_result(album_info, album_info))
except (ValueError, TypeError):
pass
length = parse_duration_string(album_info.get("subscriptContent"))
results.append(
{
'url': album_info.get("pageUrl", "").replace("http://", "https://"),
'title': album_info.get("title", ""),
'content': album_info.get("brief", {}).get("value", ""),
'template': 'videos.html',
'length': length,
'publishedDate': published_date,
'thumbnail': album_info.get("img", ""),
}
)
return results return results

View File

@@ -1663,7 +1663,7 @@ engines:
- https://pximg.example.org - https://pximg.example.org
# A proxy is required to load the images. Hosting an image proxy server # A proxy is required to load the images. Hosting an image proxy server
# for Pixiv: # for Pixiv:
# --> https://pixivfe.pages.dev/hosting-image-proxy-server/ # --> https://pixivfe-docs.pages.dev/hosting/image-proxy-server/
# Proxies from public instances. Ask the public instances owners if they # Proxies from public instances. Ask the public instances owners if they
# agree to receive traffic from SearXNG! # agree to receive traffic from SearXNG!
# --> https://codeberg.org/VnPower/PixivFE#instances # --> https://codeberg.org/VnPower/PixivFE#instances