fix(route): pianyuan domain changes (#6951)

* fix: format errors in `/sustech/bidding` and `/sustech/newshub-zh`

also see <https://github.com/DIYgod/RSSHub/actions/runs/565624803>

* fix: pianyuan domain changes (#6904)

Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
Queensferry 2021-02-23 08:08:31 +08:00 committed by GitHub
parent 3a718d025f
commit 0be82b2dd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 53 additions and 56 deletions

View File

@ -17,7 +17,7 @@ module.exports = async (ctx) => {
// 使用 cheerio 加载返回的 HTML
const data = response.data;
const $ = cheerio.load(data, {
xmlMode: true
xmlMode: true,
});
const list = $('item');

View File

@ -3,7 +3,7 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => {
const media = ctx.params.media || -1;
const link_base = 'http://pianyuan.la/';
const link_base = 'http://pianyuan.tv/';
let description = '电影和剧集';
let link = link_base;
if (media !== -1) {

View File

@ -2,35 +2,33 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'http://biddingoffice.sustech.edu.cn/',
});
const response = await got({
method: 'get',
url: 'http://biddingoffice.sustech.edu.cn/',
});
const data = response.data;
const data = response.data;
const $ = cheerio.load(data);
const $ = cheerio.load(data);
const list = $('.index-wrap.index-2 ul li');
const list = $('.index-wrap.index-2 ul li');
ctx.state.data = {
title: '南方科技大学采购与招标管理部',
link: 'http://biddingoffice.sustech.edu.cn/',
item:
list &&
list
.map((index, item) => {
item = $(item);
itemPicUrl = `${item.find('div > a:nth-child(1) > img').attr('herf')}`;
itemPubdate = item.find('li > span').text();
return {
pubDate: itemPubdate,
title: item.find('li > a').text(),
description: item.find('li > a').text(),
link: item.find('li > a').attr('href'),
};
})
.get(),
};
ctx.state.data = {
title: '南方科技大学采购与招标管理部',
link: 'http://biddingoffice.sustech.edu.cn/',
item:
list &&
list
.map((index, item) => {
item = $(item);
const itemPubdate = item.find('li > span').text();
return {
pubDate: itemPubdate,
title: item.find('li > a').text(),
description: item.find('li > a').text(),
link: item.find('li > a').attr('href'),
};
})
.get(),
};
};

View File

@ -2,35 +2,34 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://newshub.sustech.edu.cn/zh/news/',
});
const response = await got({
method: 'get',
url: 'https://newshub.sustech.edu.cn/zh/news/',
});
const data = response.data;
const data = response.data;
const $ = cheerio.load(data);
const $ = cheerio.load(data);
const list = $('.m-newslist ul li');
const list = $('.m-newslist ul li');
ctx.state.data = {
title: '南方科技大学新闻网-中文',
link: 'https://newshub.sustech.edu.cn/zh/news/',
item:
list &&
list
.map((index, item) => {
item = $(item);
itemPicUrl = `${item.find('a > div.u-pic').attr('style')}`.replace('background-image:url(', 'https://newshub.sustech.edu.cn/').replace(');', '');
itemPubdate = item.find('a > div.u-date').text();
return {
pubDate: itemPubdate,
title: item.find('a > div.u-text > div.title.f-clamp').text(),
description: `<img src="${itemPicUrl}" class="type:primaryImage" ><br>${item.find('a > div.u-text > div.details.f-clamp4 > p').text()}`,
link: item.find('a').attr('href'),
};
})
.get(),
};
ctx.state.data = {
title: '南方科技大学新闻网-中文',
link: 'https://newshub.sustech.edu.cn/zh/news/',
item:
list &&
list
.map((index, item) => {
item = $(item);
const itemPicUrl = `${item.find('a > div.u-pic').attr('style')}`.replace('background-image:url(', 'https://newshub.sustech.edu.cn/').replace(');', '');
const itemPubdate = item.find('a > div.u-date').text();
return {
pubDate: itemPubdate,
title: item.find('a > div.u-text > div.title.f-clamp').text(),
description: `<img src="${itemPicUrl}" class="type:primaryImage" ><br>${item.find('a > div.u-text > div.details.f-clamp4 > p').text()}`,
link: item.find('a').attr('href'),
};
})
.get(),
};
};