diff --git a/docs/other.md b/docs/other.md index 726cd6087b..67b3e072d1 100644 --- a/docs/other.md +++ b/docs/other.md @@ -338,6 +338,35 @@ type 为 all 时,category 参数不支持 cost 和 free +## 律师事务所文章 + +### 君合 + + + +### 通商 + + + +### 海问 + + + +### 环球 + + + +### 国枫 + + + +### 中伦 + + + +### 锦天城 + + ## 马良行 ### 产品更新 diff --git a/lib/router.js b/lib/router.js index f8348f7ad9..289ad79bd5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2771,6 +2771,27 @@ router.get('/zhutix/latest', require('./routes/zhutix/latest')); // arXiv router.get('/arxiv/:query', require('./routes/arxiv/query')); +// 环球律师事务所文章 +router.get('/law/hq', require('./routes/law/hq')); + +// 海问律师事务所文章 +router.get('/law/hw', require('./routes/law/hw')); + +// 国枫律师事务所文章 +router.get('/law/gf', require('./routes/law/gf')); + +// 通商律师事务所文章 +router.get('/law/ts', require('./routes/law/ts')); + +// 锦天城律师事务所文章 +router.get('/law/jtc', require('./routes/law/jtc')); + +// 中伦律师事务所文章 +router.get('/law/zl', require('./routes/law/zl')); + +// 君合律师事务所文章 +router.get('/law/jh', require('./routes/law/jh')); + // Mobilism router.get('/mobilism/release', require('./routes/mobilism/release')); diff --git a/lib/routes/law/gf.js b/lib/routes/law/gf.js new file mode 100644 index 0000000000..1d59950d90 --- /dev/null +++ b/lib/routes/law/gf.js @@ -0,0 +1,41 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.grandwaylaw.com/cn/publications/articles.html'; + const ori_url = 'http://www.grandwaylaw.com'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('.cbw ul li').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('a').html(); + const sub_url = $('a').attr('href'); + const itemUrl = ori_url + sub_url; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('.xwzz .txt').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/hq.js b/lib/routes/law/hq.js new file mode 100644 index 0000000000..008075b3aa --- /dev/null +++ b/lib/routes/law/hq.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.glo.com.cn/news/publications_list13.html'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('ul.ul-list li').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('a').attr('title'); + const itemUrl = $('a').attr('href'); + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('article').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/hw.js b/lib/routes/law/hw.js new file mode 100644 index 0000000000..c3296ef2fa --- /dev/null +++ b/lib/routes/law/hw.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.haiwen-law.com/class/view?id=19'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('div.newlist ul li.clearfix').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('.ittitle a').html(); + const itemUrl = $('.ittitle a').attr('href'); + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('.large').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/jh.js b/lib/routes/law/jh.js new file mode 100644 index 0000000000..9627a6cd26 --- /dev/null +++ b/lib/routes/law/jh.js @@ -0,0 +1,41 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.junhe.com/legal-updates'; + const ori_url = 'http://www.junhe.com'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('.news-content ul.list').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('h1').html(); + const sub_url = $('a').attr('href'); + const itemUrl = ori_url + sub_url; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('.d-content').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/jtc.js b/lib/routes/law/jtc.js new file mode 100644 index 0000000000..52533c6fcd --- /dev/null +++ b/lib/routes/law/jtc.js @@ -0,0 +1,41 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'https://www.allbrightlaw.com/CN/10475.aspx'; + const ori_url = 'https://www.allbrightlaw.com'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('.news_list_img ul li').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('.news_txt h2').html(); + const sub_url = $('a').attr('href'); + const itemUrl = ori_url + sub_url; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('.news_content_box .news_content').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/ts.js b/lib/routes/law/ts.js new file mode 100644 index 0000000000..cb3fa32344 --- /dev/null +++ b/lib/routes/law/ts.js @@ -0,0 +1,41 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.tongshang.com/researches'; + const ori_url = 'http://www.tongshang.com'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('.tableList .newsTab').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const title = $('a').html(); + const sub_url = $('a').attr('href'); + const itemUrl = ori_url + sub_url; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title, + link: itemUrl, + description: $d('.col-md-9').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +}; diff --git a/lib/routes/law/zl.js b/lib/routes/law/zl.js new file mode 100644 index 0000000000..47a7db7907 --- /dev/null +++ b/lib/routes/law/zl.js @@ -0,0 +1,40 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const url = 'http://www.zhonglun.com/zx/zlgd.html'; + const ori_url = 'http://www.zhonglun.com'; + const res = await got.get(url); + const $ = cheerio.load(res.data); + const list = $('.zx_list ul li').get(); + + const out = await Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const sub_url = $('a').attr('href'); + const itemUrl = ori_url + sub_url; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const responses = await got.get(itemUrl); + const $d = cheerio.load(responses.data); + + const single = { + title: $d('.news_main .txt span').html(), + link: itemUrl, + description: $d('.news_main').html(), + }; + + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + ctx.state.data = { + title: $('title').text(), + link: url, + item: out, + }; +};