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 #564 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
10 changed files
with
143 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
|
||
module.exports = async (ctx) => { | ||
const { keyword } = ctx.params; | ||
|
||
const { data: response, url: link } = await got('https://www.google.com/alerts/preview', { | ||
searchParams: { | ||
params: `[null,[null,null,null,[null,"${keyword}","com",[null,"en","US"],null,null,null,0,0],null,3,[[null,1,"[email protected]",[null,null,20],2,"en-US",null,null,null,null,null,"0",null,null,"AB2Xq4hcilCERh73EFWJVHXx-io2lhh1EhC8UD8"]]],0]`, | ||
}, | ||
}); | ||
|
||
const $ = cheerio.load(response, null, false); | ||
|
||
const items = $('li.result') | ||
.toArray() | ||
.map((item) => { | ||
item = $(item); | ||
const title = item.find('.result_title a'); | ||
return { | ||
title: title.text(), | ||
link: new URL(title.attr('href')).searchParams.get('url'), | ||
author: item.find('.result_source').text(), | ||
description: item.find('.snippet').html(), | ||
}; | ||
}); | ||
|
||
ctx.state.data = { | ||
title: `Google Alerts - ${keyword}`, | ||
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { TITLE, HOST } = require('./const'); | ||
const { fetchCityList, fetchStyleList } = require('./service'); | ||
|
||
module.exports = async (ctx) => { | ||
const type = ctx.params.type; | ||
switch (type) { | ||
case 'city': | ||
ctx.state.data = { | ||
title: `${TITLE} - 演出城市`, | ||
link: `HOST`, | ||
item: await fetchCityList(), | ||
}; | ||
break; | ||
case 'style': | ||
ctx.state.data = { | ||
title: `${TITLE} - 演出风格`, | ||
link: HOST, | ||
item: await fetchStyleList(), | ||
}; | ||
break; | ||
} | ||
}; |
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,4 +1,5 @@ | ||
module.exports = (router) => { | ||
router.get('/event/:cityCode/:showStyle?', require('./event')); | ||
router.get('/search/:keyword', require('./search')); | ||
router.get('/search/:keyword?', require('./search')); | ||
router.get('/params/:type', require('./params')); | ||
}; |
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