Skip to content

Commit

Permalink
Merge pull request #1 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Apr 26, 2024
2 parents 7e87a48 + 8278508 commit 7a3e1f2
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 13 deletions.
39 changes: 39 additions & 0 deletions lib/routes/ollama/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';

export const route: Route = {
path: '/library',
categories: ['programming'],
example: '/ollama/library',
radar: [
{
source: ['ollama.com/library'],
},
],
name: 'Models',
maintainers: ['Nick22nd'],
handler,
};
async function handler() {
const response = await ofetch('https://ollama.com/library');
const $ = load(response);
const items = $('#repo > ul > li > a')
.toArray()
.map((item) => {
const name = $(item).children('h2').first();
const link = $(item).attr('href');
const description = $(item).children('p').first();

return {
title: name.text(),
link,
description: description.text(),
};
});
return {
title: 'ollama library',
link: 'https://ollama.com/library',
item: items,
};
}
6 changes: 6 additions & 0 deletions lib/routes/ollama/namespace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { Namespace } from '@/types';

export const namespace: Namespace = {
name: 'Ollama',
url: 'ollama.com',
};
6 changes: 3 additions & 3 deletions lib/routes/stbu/jsjxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ export const route: Route = {
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['jsjxy.stbu.edu.cn/news', 'jsjxy.stbu.edu.cn/'],
source: ['jsjxy.stbu.edu.cn/news', 'jsjxy.stbu.edu.cn', 'stbu.edu.cn'],
},
],
name: '计算机学院通知公告',
name: '计算机学院 - 通知公告',
maintainers: ['HyperCherry'],
handler,
url: 'jsjxy.stbu.edu.cn/news',
Expand Down
17 changes: 14 additions & 3 deletions lib/routes/stbu/xyxw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,30 @@ import timezone from '@/utils/timezone';
const gbk2utf8 = (s) => iconv.decode(s, 'gbk');
export const route: Route = {
path: '/xyxw',
categories: ['university'],
example: '/stbu/xyxw',
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
radar: [
{
source: ['stbu.edu.cn/html/news/xueyuan', 'stbu.edu.cn/'],
source: ['stbu.edu.cn/html/news/xueyuan', 'stbu.edu.cn'],
},
],
name: 'Unknown',
name: '学院新闻',
maintainers: ['HyperCherry'],
handler,
url: 'stbu.edu.cn/html/news/xueyuan',
};

async function handler() {
const baseUrl = 'https://www.stbu.edu.cn';
const baseUrl = 'http://www.stbu.edu.cn';
const requestUrl = `${baseUrl}/html/news/xueyuan/`;
const { data: response } = await got(requestUrl, {
responseType: 'buffer',
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"scripts": {
"build": "tsx scripts/workflow/build-routes.ts",
"build:docs": "tsx scripts/workflow/build-docs.ts",
"dev": "cross-env NODE_ENV=dev tsx watch --no-cache lib/index.ts",
"dev:cache": "cross-env NODE_ENV=production tsx watch lib/index.ts",
"dev": "cross-env NODE_ENV=dev tsx watch --clear-screen=false lib/index.ts",
"dev:cache": "cross-env NODE_ENV=production tsx watch --clear-screen=false lib/index.ts",
"format": "prettier \"**/*.{ts,tsx,js,json}\" --write && eslint --cache --fix \"**/*.{ts,tsx,js,yml}\"",
"format:check": "prettier \"**/*.{ts,tsx,js,json}\" --check && eslint --cache \"**/*.{ts,tsx,js,yml}\"",
"format:staged": "lint-staged",
Expand All @@ -50,7 +50,7 @@
"*.yml": "eslint --cache --fix"
},
"dependencies": {
"@hono/node-server": "1.11.0",
"@hono/node-server": "1.11.1",
"@hono/swagger-ui": "0.2.1",
"@hono/zod-openapi": "0.11.0",
"@notionhq/client": "2.2.15",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a3e1f2

Please sign in to comment.