diff --git a/lib/router.js b/lib/router.js
index 780eb2744..fef63a380 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -442,7 +442,7 @@ router.get('/cpu/yjsy', lazyloadRouteHandler('./routes/universities/cpu/yjsy'));
router.get('/zimuku/:type?', lazyloadRouteHandler('./routes/zimuku/index'));
// Steam
-router.get('/steam/search/:params', lazyloadRouteHandler('./routes/steam/search'));
+// router.get('/steam/search/:params', lazyloadRouteHandler('./routes/steam/search'));
// Steamgifts
router.get('/steamgifts/discussions/:category?', lazyloadRouteHandler('./routes/steam/steamgifts/discussions'));
diff --git a/lib/routes-deprecated/steam/search.js b/lib/routes-deprecated/steam/search.js
deleted file mode 100644
index d115afaa8..000000000
--- a/lib/routes-deprecated/steam/search.js
+++ /dev/null
@@ -1,57 +0,0 @@
-const got = require('@/utils/got');
-const cheerio = require('cheerio');
-const qs = require('querystring');
-const queryString = require('query-string');
-
-module.exports = async (ctx) => {
- const { params } = ctx.params;
- const query = qs.parse(params);
- const { data: html } = await got.get(`https://store.steampowered.com/search/results`, {
- searchParams: queryString.stringify(query),
- });
- const $ = cheerio.load(html);
-
- ctx.state.data = {
- title: 'Steam search result',
- description: `Query: ${qs.stringify(query)}`,
- link: /g_strUnfilteredURL\s=\s'(.*)'/.exec(html)[1],
- item: $('#search_result_container a')
- .toArray()
- .map((a) => {
- const $el = $(a);
- const isBundle = !!$el.attr('data-ds-bundle-data');
- const isDiscounted = $el.find('.search_price.discounted').length > 0;
- const hasReview = $el.find('.search_review_summary').length > 0;
- let desc = '';
- if (isBundle) {
- const bundle = JSON.parse($el.attr('data-ds-bundle-data'));
- desc += 'Bundle\n';
- if (bundle.m_bRestrictGifting) {
- desc += 'Restrict gifting\n';
- }
- desc += `Items count: ${bundle.m_rgItems.length}\n`;
- }
- if (isDiscounted) {
- desc += `Discount: ${$el.find('.search_discount span').text().trim()}\n`;
- desc += `Original price: ${$el.find('.search_price strike').text().trim()}\n`;
- desc += `Discounted price: ${$el
- .find('.search_price')
- .contents()
- .filter((i, e) => e.nodeType === 3)
- .text()
- .trim()}\n`;
- } else {
- desc += `Price: ${$el.find('.search_price').text().trim()}\n`;
- }
- if (hasReview) {
- desc += $el.find('.search_review_summary').attr('data-tooltip-html');
- }
- return {
- title: $el.find('span.title').text(),
- link: $el.attr('href'),
- description: desc.replaceAll('\n', '
'),
- };
- })
- .filter((it) => it.title),
- };
-};
diff --git a/lib/routes/steam/namespace.ts b/lib/routes/steam/namespace.ts
new file mode 100644
index 000000000..0ecb6b79f
--- /dev/null
+++ b/lib/routes/steam/namespace.ts
@@ -0,0 +1,6 @@
+import type { Namespace } from '@/types';
+
+export const namespace: Namespace = {
+ name: 'Steam',
+ url: 'store.steampowered.com',
+};
diff --git a/lib/routes/steam/search.ts b/lib/routes/steam/search.ts
new file mode 100644
index 000000000..ed23b8028
--- /dev/null
+++ b/lib/routes/steam/search.ts
@@ -0,0 +1,64 @@
+import type { Route } from '@/types';
+import got from '@/utils/got';
+import { load } from 'cheerio';
+
+export const route: Route = {
+ path: '/search/:params',
+ categories: ['game'],
+ example: '/steam/search/sort_by=Released_DESC&tags=492&category1=10&os=linux',
+ parameters: { params: 'Query parameters for a Steam Store search.' },
+ radar: [
+ {
+ source: ['store.steampowered.com', 'store.steampowered.com/search/:params'],
+ },
+ ],
+ name: 'Store Search',
+ maintainers: ['moppman'],
+ handler,
+};
+
+async function handler(ctx) {
+ const query = new URLSearchParams(ctx.req.param('params'));
+ const { data: html } = await got('https://store.steampowered.com/search/', {
+ searchParams: query,
+ });
+ const $ = load(html);
+ return {
+ title: 'Steam search result',
+ description: `Query: ${query.toString()}`,
+ link: /g_strUnfilteredURL\s=\s'(.*)'/.exec(html)[1],
+ item: $('#search_result_container a')
+ .toArray()
+ .map((a) => {
+ const $el = $(a);
+ const isBundle = !!$el.attr('data-ds-bundle-data');
+ const isDiscounted = $el.find('.discount_original_price').length > 0;
+ const hasReview = $el.find('.search_review_summary').length > 0;
+ let desc = '';
+ if (isBundle) {
+ const bundle = JSON.parse($el.attr('data-ds-bundle-data'));
+ desc += 'Bundle\n';
+ if (bundle.m_bRestrictGifting) {
+ desc += 'Restrict gifting\n';
+ }
+ desc += `Items count: ${bundle.m_rgItems.length}\n`;
+ }
+ if (isDiscounted) {
+ desc += `Discount: ${$el.find('.discount_pct').text().trim()}\n`;
+ desc += `Original price: ${$el.find('.discount_original_price').text().trim()}\n`;
+ desc += `Discounted price: ${$el.find('.discount_final_price').text().trim()}\n`;
+ } else {
+ desc += `Price: ${$el.find('.discount_final_price').text().trim()}\n`;
+ }
+ if (hasReview) {
+ desc += $el.find('.search_review_summary').attr('data-tooltip-html');
+ }
+ return {
+ title: $el.find('span.title').text(),
+ link: $el.attr('href'),
+ description: desc.replaceAll('\n', '
'),
+ };
+ })
+ .filter((it) => it.title),
+ };
+}