mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): ikea (#11685)
This commit is contained in:
+2
-2
@@ -85,11 +85,11 @@ Parameter `time` only works when `mostwanted` is chosen as the category.
|
||||
|
||||
### UK - New Product Release
|
||||
|
||||
<RouteEn author="HenryQW" example="/ikea/uk/new" path="/ikea/uk/new"/>
|
||||
<RouteEn author="HenryQW" example="/ikea/gb/new" path="/ikea/gb/new"/>
|
||||
|
||||
### UK - Offers
|
||||
|
||||
<RouteEn author="HenryQW" example="/ikea/uk/offer" path="/ikea/uk/offer"/>
|
||||
<RouteEn author="HenryQW" example="/ikea/gb/offer" path="/ikea/gb/offer"/>
|
||||
|
||||
## LeBonCoin
|
||||
|
||||
|
||||
+10
-10
@@ -95,6 +95,16 @@ pageClass: routes
|
||||
|
||||
<Route author="DIYgod" example="/hotukdeals/hottest" path="/hotukdeals/hottest"></Route>
|
||||
|
||||
## IKEA 宜家
|
||||
|
||||
### 英国 - 商品上新
|
||||
|
||||
<Route author="HenryQW" example="/ikea/gb/new" path="/ikea/gb/new" radar="1"/>
|
||||
|
||||
### 英国 - 促销
|
||||
|
||||
<Route author="HenryQW" example="/ikea/gb/offer" path="/ikea/gb/offer" radar="1"/>
|
||||
|
||||
## lativ
|
||||
|
||||
### 订阅价格
|
||||
@@ -471,16 +481,6 @@ For instance, in <https://www.leboncoin.fr/recherche/?**category=10&locations=Pa
|
||||
|
||||
<Route author="xyqfer DIYgod bigfei" example="/xiaomiyoupin/latest" path="/xiaomiyoupin/latest" />
|
||||
|
||||
## 宜家 IKEA
|
||||
|
||||
### 宜家 IKEA(英国)- 商品上新
|
||||
|
||||
<Route author="HenryQW" example="/ikea/uk/new" path="/ikea/uk/new"/>
|
||||
|
||||
### 宜家 IKEA(英国)- 促销
|
||||
|
||||
<Route author="HenryQW" example="/ikea/uk/offer" path="/ikea/uk/offer"/>
|
||||
|
||||
## 优衣库
|
||||
|
||||
### Stylingbook
|
||||
|
||||
+2
-2
@@ -2280,8 +2280,8 @@ router.get('/centbrowser/history', lazyloadRouteHandler('./routes/centbrowser/hi
|
||||
router.get('/755/user/:username', lazyloadRouteHandler('./routes/755/user'));
|
||||
|
||||
// IKEA
|
||||
router.get('/ikea/uk/new', lazyloadRouteHandler('./routes/ikea/uk/new'));
|
||||
router.get('/ikea/uk/offer', lazyloadRouteHandler('./routes/ikea/uk/offer'));
|
||||
// router.get('/ikea/uk/new', lazyloadRouteHandler('./routes/ikea/uk/new'));
|
||||
// router.get('/ikea/uk/offer', lazyloadRouteHandler('./routes/ikea/uk/offer'));
|
||||
|
||||
// Mastodon
|
||||
router.get('/mastodon/timeline/:site/:only_media?', lazyloadRouteHandler('./routes/mastodon/timeline_local'));
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.ikea.com/gb/en/news/product-news-gallery/';
|
||||
|
||||
const count = (await got.get('https://sik.search.blue.cdtapps.com/gb/en/product-list-page?category=products&f-toggles2=new_product')).data.productListPage.productCount;
|
||||
|
||||
const products = (await got.get(`http://sik.search.blue.cdtapps.com/gb/en/product-list-page/more-products?category=products&start=1&end=${count}`)).data.moreProducts.productWindow;
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'IKEA UK - New Products',
|
||||
link,
|
||||
description: 'New products released by IKEA UK.',
|
||||
item: products.map((p) => ({
|
||||
title: `${p.name} ${p.typeName} ${p.itemMeasureReferenceText}`,
|
||||
description: `<img src="${p.mainImageUrl}">`,
|
||||
link: p.pipUrl,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.ikea.com/gb/en/ikea-family/discounts/';
|
||||
|
||||
const items = [];
|
||||
|
||||
const loadProductsOnPage = (data) => {
|
||||
const $ = cheerio.load(data);
|
||||
const products = $('.range-revamp-product-compact').get();
|
||||
|
||||
if (products.length > 0) {
|
||||
for (const p of products) {
|
||||
const price = $(p).find('.range-revamp-compact-price-package__price-wrapper').text();
|
||||
|
||||
if (!price) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let title = $(p).find('.range-revamp-header-section__title--small').text() + ' ';
|
||||
|
||||
title += $(p).find('.range-revamp-header-section__description-text').text().trim() + ' ';
|
||||
|
||||
const previous = $(p).find('.range-revamp-compact-price-package__previous-price-text').next('span').text();
|
||||
|
||||
title += `[${previous} ▶️ ${price}]`;
|
||||
|
||||
const link = $(p).find('.range-revamp-product-compact__bottom-wrapper > a').attr('href');
|
||||
|
||||
items.push({
|
||||
title,
|
||||
description: `<img src='${$($(p).find('.range-revamp-aspect-ratio-image__image')[1]).attr('data-src')}'>`,
|
||||
link,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const response = await got.get(link);
|
||||
|
||||
loadProductsOnPage(response.data);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $('.text.component a')
|
||||
.get()
|
||||
.map((e) => $(e).attr('href'));
|
||||
|
||||
if (list.length > 0) {
|
||||
await Promise.all(
|
||||
list.map(async (url) => {
|
||||
const response = await got.get(url);
|
||||
loadProductsOnPage(response.data);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'IKEA UK - Offers',
|
||||
link,
|
||||
description: 'Offers by IKEA UK.',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
const got = require('@/utils/got');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.ikea.com/gb/en/new/new-products/';
|
||||
|
||||
const {
|
||||
data: { specialPage },
|
||||
} = await got('https://sik.search.blue.cdtapps.com/gb/en/special', {
|
||||
searchParams: {
|
||||
special: 'new_product',
|
||||
// size: 24,
|
||||
// 'subcategories-style': 'tree-navigation',
|
||||
// c: 'lf',
|
||||
// v: 20220826,
|
||||
// sort: 'RELEVANCE',
|
||||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: {
|
||||
moreProducts: { productWindow },
|
||||
},
|
||||
} = await got('https://sik.search.blue.cdtapps.com/gb/en/special/more-products', {
|
||||
searchParams: {
|
||||
special: 'new_product',
|
||||
start: 24,
|
||||
end: specialPage.productCount,
|
||||
// 'subcategories-style': 'tree-navigation',
|
||||
// c: 'lf',
|
||||
// v: 20220826,
|
||||
// sort: 'RELEVANCE',
|
||||
},
|
||||
});
|
||||
|
||||
const products = [...specialPage.productWindow, ...productWindow];
|
||||
|
||||
const items = products.map((p) => ({
|
||||
title: `${p.name} ${p.typeName}, ${p.itemMeasureReferenceText}`,
|
||||
description: art(path.join(__dirname, '../templates/new.art'), {
|
||||
p,
|
||||
}),
|
||||
link: p.pipUrl,
|
||||
category: p.categoryPath.map((c) => c.name),
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'New Products - Browse All New Furniture & Home Decor - IKEA',
|
||||
link,
|
||||
description: 'New products released by IKEA UK.',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.ikea.com/gb/en/offers/';
|
||||
const response = await got(link);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const carousel = $('.pub__carousel-slide')
|
||||
.toArray()
|
||||
.map((e) => {
|
||||
e = $(e);
|
||||
const title = e.find('h3');
|
||||
const img = e.find('.pub__image').each((_, e) => {
|
||||
e.attribs.src = e.attribs.src.split('?')[0];
|
||||
delete e.attribs.srcset;
|
||||
});
|
||||
const link = new URL(e.find('pub-hide-empty-link a').attr('href'));
|
||||
const { searchParams } = link;
|
||||
searchParams.delete('itm_content');
|
||||
searchParams.delete('itm_element');
|
||||
searchParams.delete('itm_campaign');
|
||||
return {
|
||||
title: title.text(),
|
||||
description: art(path.join(__dirname, '../templates/offer.art'), {
|
||||
img: img.parent().html(),
|
||||
desc: title.next().parent().html(),
|
||||
}),
|
||||
link: link.href,
|
||||
guid: `${link.href}#${title.text()}`,
|
||||
};
|
||||
});
|
||||
|
||||
const banner = $('div[data-pub-type="banner"]')
|
||||
.toArray()
|
||||
.map((e) => {
|
||||
e = $(e);
|
||||
const title = e.find('h2');
|
||||
const next = title.next();
|
||||
const img = e.find('.pub__image').each((_, e) => {
|
||||
e.attribs.src = e.attribs.src.split('?')[0];
|
||||
delete e.attribs.srcset;
|
||||
});
|
||||
|
||||
const link = new URL(next.find('a').attr('href'));
|
||||
const { searchParams } = link;
|
||||
searchParams.delete('itm_content');
|
||||
searchParams.delete('itm_element');
|
||||
searchParams.delete('itm_campaign');
|
||||
return {
|
||||
title: title.text(),
|
||||
description: art(path.join(__dirname, '../templates/offer.art'), {
|
||||
img: img.parent().html(),
|
||||
desc: title.parent().html(),
|
||||
}),
|
||||
link: link.href,
|
||||
guid: `${link.href}#${title.text()}`,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'IKEA UK - Offers',
|
||||
link,
|
||||
description: 'Offers by IKEA UK.',
|
||||
item: [...carousel, ...banner],
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/gb/new': ['HenryQW'],
|
||||
'/gb/offer': ['HenryQW'],
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
'ikea.com': {
|
||||
_name: 'IKEA 宜家',
|
||||
'.': [
|
||||
{
|
||||
title: '英国 - 商品上新',
|
||||
docs: 'https://docs.rsshub.app/shopping.html#ikea-yi-jia',
|
||||
source: ['/gb/en/new/new-products/', '/'],
|
||||
target: '/ikea/gb/new',
|
||||
},
|
||||
{
|
||||
title: '英国 - 促销',
|
||||
docs: 'https://docs.rsshub.app/shopping.html#ikea-yi-jia',
|
||||
source: ['/gb/en/offers', '/'],
|
||||
target: '/ikea/gb/offer',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/gb/new', require('./gb/new'));
|
||||
router.get('/gb/offer', require('./gb/offer'));
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
<img src="{{ p.mainImageUrl }}" alt="{{ p.mainImageAlt }}">
|
||||
<br>
|
||||
<b>{{ p.name }}</b>
|
||||
<br>
|
||||
{{ p.typeName }}, {{ p.itemMeasureReferenceText }}
|
||||
<br>
|
||||
{{ p.salesPrice.current.prefix }} <b>{{ p.salesPrice.current.wholeNumber }}</b>
|
||||
@@ -0,0 +1,3 @@
|
||||
{{@ img }}
|
||||
<br>
|
||||
{{@ desc }}
|
||||
Reference in New Issue
Block a user