Skip to content

Commit

Permalink
Merge pull request #618 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 Dec 6, 2022
2 parents c424ce7 + 5948eef commit ef78d3b
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
uses: actions/checkout@v3

- name: Comment Dependabot PR
uses: thollander/actions-comment-pull-request@v1
uses: thollander/actions-comment-pull-request@v2
with:
message: '@dependabot ignore this dependency'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 19 additions & 1 deletion docs/en/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Note: [Source website](https://gs.bjtu.edu.cn/) only provides articles in Chines

</RouteEn>

## UMASS Amherst
## University of Massachusetts Amherst

### College of Electrical and Computer Engineering

Expand All @@ -188,3 +188,21 @@ Note:[Source website](https://ece.umass.edu/seminar) may be empty when there's
#### Featured Stories

<RouteEn author="gammapi" example="/umass/amherst/ipoevents" path="/umass/amherst/ipoevents" radar="1" rssbud="1"/>

## University of Texas at Dallas

### International Student Services

<Route author="Chang4Tech" example="/utdallas/isso" path="/utdallas/isso" />

## University of Washington

### Global Innovation Exchange News

<RouteEn author="dykderrick" example="/uw/gix/news/blog" path="/uw/gix/news/:category" :paramsDesc="['Blog Type']">

| Blog | In The News |
| ---- | ----------- |
| blog | inthenews |

</RouteEn>
14 changes: 13 additions & 1 deletion docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@ pageClass: routes

<Route author="exuanbo" example="/polimi/news" path="/polimi/news/:language?" :paramsDesc="['English language code en']" />

## UTDallas
## University of Texas at Dallas

### International Student Services

<Route author="Chang4Tech" example="/utdallas/isso" path="/utdallas/isso" />

## University of Washington

### Global Innovation Exchange News

<Route author="dykderrick" example="/uw/gix/news/blog" path="/uw/gix/news/:category" :paramsDesc="['Blog Type']">

| Blog | In The News |
| ---- | ----------- |
| blog | inthenews |

</Route>

## 安徽工业大学

### 教务处
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/gov/customs/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = async (ctx) => {
break;
}

const browser = await require('@/utils/puppeteer')();
const browser = await require('@/utils/puppeteer')({ stealth: true });

const list = await ctx.cache.tryGet(
link,
Expand Down
2 changes: 1 addition & 1 deletion lib/v2/gov/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'/cmse/kpjy/:id': ['nczitzk'],
'/cmse/:path+': ['nczitzk'],
'/cnnic/:path+': ['nczitzk'],
'/customs/list/:gchannel?': ['Jeason0228', 'TonyRL'],
'/customs/list/:gchannel?': ['Jeason0228', 'TonyRL', 'he1q'],
'/fmprc/:category?': ['nicolaszf', 'nczitzk'],
'/immiau/news': ['liu233w'],
'/mee/ywdt?': ['liuxsdev'],
Expand Down
67 changes: 67 additions & 0 deletions lib/v2/uw/gix/news.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');

const gixBaseURL = 'https://gixnetwork.org';

module.exports = async (ctx) => {
const category = ctx.params.category;

let newsURL = gixBaseURL + '/news';
let feedTitle = 'UW GIX News - ';
let listSelector = 'body > div.site > div.site-content > div.content-area > main.site-main > ';

switch (category) {
case 'blog':
newsURL += '/blog/';
feedTitle += 'Blogs';
listSelector += 'div.blog-wrapper > section.blog-list > article';
break;
case 'inthenews':
newsURL += '/inthenews/';
feedTitle += 'In The News';
listSelector += 'div.news-wrapper > section.news-list > article';
break;
}

const response = await got(newsURL);

const data = response.data;

const $ = cheerio.load(data);

const list = $(listSelector)
.map((index, item) => {
item = $(item);
const content = item.find('header').find('h2').find('a');
const time = item.find('header').find('span.h4').text();

return {
// title: content.text(),
time,
link: content.attr('href'),
};
})
.get();

const itemContent = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const descriptionResponse = await got(item.link);

const content = cheerio.load(descriptionResponse.data);

item.title = content('header.entry-header').find('h1').text();
item.description = content('div.entry-content').html();
item.pubDate = Date.parse(item.time);

return item;
})
)
);

ctx.state.data = {
title: feedTitle,
link: newsURL,
item: itemContent,
};
};
3 changes: 3 additions & 0 deletions lib/v2/uw/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/gix/news/:category': ['dykderrick'],
};
13 changes: 13 additions & 0 deletions lib/v2/uw/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'gixnetwork.org': {
_name: 'University of Washington',
'.': [
{
title: 'Global Innovation Exchange News',
docs: 'https://docs.rsshub.app/university.html#university-of-washington',
source: ['/news/:category'],
target: '/uw/gix/news/:category',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/uw/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/gix/news/:category', require('./gix/news'));
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"puppeteer-extra": "3.3.4",
"puppeteer-extra-plugin-stealth": "2.11.1",
"query-string": "7.1.3",
"rand-user-agent": "1.0.92",
"rand-user-agent": "1.0.93",
"re2": "1.17.8",
"require-all": "3.0.0",
"rss-parser": "3.12.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11584,10 +11584,10 @@ ramda@^0.26.1:
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06"
integrity sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==

rand-user-agent@1.0.92:
version "1.0.92"
resolved "https://registry.yarnpkg.com/rand-user-agent/-/rand-user-agent-1.0.92.tgz#1ed7d6b6f05dc3b83f90761ff9aaf42af7ff7da2"
integrity sha512-kX6bxvq29Jb59XslWgpmHGJ+S6TCULgpR9MVcYPb0eO05j8XV/M/3HmSdimfHEcFvczJA/ILLkHDoxRtyc8Ivw==
rand-user-agent@1.0.93:
version "1.0.93"
resolved "https://registry.yarnpkg.com/rand-user-agent/-/rand-user-agent-1.0.93.tgz#1b1aa5035c66892328878bf63e9b0916a73a0e0d"
integrity sha512-S9+nr4yaTUtzhLi4VBiPXydFI/e95S7NcJPG4D80arZPu0Q90EjTjJZNbCW5QGLKdc6Ze9A0S7MBK5gs97LBug==

randexp@0.4.6:
version "0.4.6"
Expand Down

1 comment on commit ef78d3b

@vercel
Copy link

@vercel vercel bot commented on ef78d3b Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.