forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #891 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
16 changed files
with
379 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = { | ||
'/news/:category': ['yuxinliu-alex'], | ||
'/column/:id?': ['yuxinliu-alex', 'nczitzk'], | ||
'/:id?': ['yuxinliu-alex', 'nczitzk'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
module.exports = function (router) { | ||
router.get('/news/:category', require('./index')); | ||
router.get('/column/:id?', require('./')); | ||
router.get('/:id?', require('./')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{{ if video }} | ||
<video controls poster="{{ cover }}"> | ||
<source src="{{ video }}" type="video/mp4"> | ||
</video> | ||
{{ /if }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const cheerio = require('cheerio'); | ||
const got = require('@/utils/got'); | ||
const path = require('path'); | ||
const timezone = require('@/utils/timezone'); | ||
const { art } = require('@/utils/render'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const baseUrl = 'https://community.modelscope.cn'; | ||
|
||
const { data } = await got.post(`${baseUrl}/v1/namespace_page/article`, { | ||
json: { id: 142373, notInMediaAidList: [], pageNum: 1, pageSize: ctx.query.limit ? parseInt(ctx.query.limit) : 30 }, | ||
}); | ||
|
||
const articles = data.data.content.map((c) => ({ | ||
title: c.content.name, | ||
description: c.content.desc, | ||
author: c.nickname, | ||
link: `${baseUrl}/${c.content.id}.html`, | ||
pubDate: timezone(parseDate(c.content.createdTime), 8), | ||
category: c.content.externalData.tags.map((t) => t.name), | ||
thumb: c.content.thumb, | ||
})); | ||
|
||
const items = await Promise.all( | ||
articles.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data } = await got(item.link); | ||
|
||
const $ = cheerio.load(data); | ||
const initialData = JSON.parse( | ||
$('script') | ||
.text() | ||
.match(/window\.__INITIAL_STATE__\s*=\s*({.*?});/)[1] | ||
); | ||
|
||
item.description = art(path.join(__dirname, 'templates/community.art'), { | ||
thumb: item.thumb, | ||
quote: item.description, | ||
content: initialData.pageData.detail.ext.content, | ||
}); | ||
|
||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: 'ModelScope魔搭社区-DevPress官方社区', | ||
description: 'ModelScope魔搭社区 DevPress官方社区-ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单。', | ||
image: 'https://g.alicdn.com/sail-web/maas/0.8.10/favicon/128.ico', | ||
link: baseUrl, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const got = require('@/utils/got'); | ||
const md = require('markdown-it')({ | ||
html: true, | ||
linkify: true, | ||
}); | ||
const path = require('path'); | ||
const { art } = require('@/utils/render'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const baseUrl = 'https://modelscope.cn'; | ||
const link = `${baseUrl}/datasets`; | ||
|
||
const { data } = await got(`${baseUrl}/api/v1/dolphin/datasets`, { | ||
searchParams: { | ||
PageSize: ctx.query.limit ? parseInt(ctx.query.limit) : 36, | ||
PageNumber: 1, | ||
Target: '', | ||
Sort: 'gmt_modified', | ||
}, | ||
}); | ||
|
||
const datasets = data.Data.map((dataset) => ({ | ||
title: dataset.ChineseName, | ||
description: dataset.Description, | ||
author: dataset.CreatedBy, | ||
link: `${link}/${dataset.Namespace}/${dataset.Name}`, | ||
pubDate: parseDate(dataset.GmtCreate, 'X'), | ||
category: dataset.UserDefineTags.split(','), | ||
slug: `/${dataset.Namespace}/${dataset.Name}`, | ||
})); | ||
|
||
const items = await Promise.all( | ||
datasets.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data } = await got(`${baseUrl}/api/v1/datasets${item.slug}`); | ||
|
||
const content = data.Data.ReadmeContent.replace(/img src="(?!http)(.*?)"/g, `img src="${baseUrl}/api/v1/datasets${item.slug}/repo?Revision=master&FilePath=$1&View=true"`); | ||
item.description = art(path.join(__dirname, 'templates/desc.art'), { | ||
description: item.description, | ||
md: md.render(content), | ||
}); | ||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: '数据集首页 · 魔搭社区', | ||
description: 'ModelScope——汇聚各领域先进的机器学习模型,提供模型探索体验、推理、训练、部署和应用的一站式服务。在这里,共建模型开源社区,发现、学习、定制和分享心仪的模型。', | ||
image: 'https://g.alicdn.com/sail-web/maas/0.8.10/favicon/128.ico', | ||
link, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
'/community': ['TonyRL'], | ||
'/datasets': ['TonyRL'], | ||
'/models': ['TonyRL'], | ||
'/studios': ['TonyRL'], | ||
}; |
Oops, something went wrong.
4b42edf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master.vercel.app
rsshub-master-git-master-auto-bot-ty.vercel.app
rsshub-master-auto-bot-ty.vercel.app