feat: add javlibrary all related (#3892)

This commit is contained in:
junfengP
2020-02-05 17:26:54 +08:00
committed by GitHub
parent f6baa8d2cc
commit 72a36bc289
8 changed files with 75 additions and 16 deletions
+16 -4
View File
@@ -30,13 +30,25 @@ Official RSS: https://eztv.io/ezrss.xml
## JavLibrary
### Best rated videos
### Videos
<RouteEn author="DIYgod" example="/javlibrary/bestrated" path="/javlibrary/bestrated"/>
<Route author="Diygod junfengP" example="/javlibrary/videos/bestrated" path="/javlibrary/videos/:vtype" :paramsDesc="['video type']" >
|New Comments|New Release|New Entries|Most Wanted|Best Rated|
|-----|------|------|-----|------|
|update|newrelease|newentries|mostwanted|bestrated|
</Route>
### User posts
### Stars
<RouteEn author="junfengP" example="/javlibrary/userposts/siccalol" path="/javlibrary/userposts/:uid" :paramsDesc="['User id']" />
<Route author="Diygod junfengP" example="/javlibrary/stars/afisw" path="/javlibrary/stars/:sid" :paramsDesc="['star id, find it from link']" />
### Users
<Route author="Diygod junfengP" example="/javlibrary/users/mangudai/userposts" path="/javlibrary/users/:uid/:utype" :paramsDesc="['user id','user choice, see table below']" >
|User wanted|User watched|User owned|User posts|
|-----|------|------|-----|
|userwanted|userwatched|userowned|userposts|
</Route>
## Nyaa
+16 -4
View File
@@ -120,13 +120,25 @@ pageClass: routes
## JavLibrary
### 评价最高的影片
### 影片
<Route author="DIYgod" example="/javlibrary/bestrated" path="/javlibrary/bestrated"/>
<Route author="Diygod junfengP" example="/javlibrary/videos/bestrated" path="/javlibrary/videos/:vtype" :paramsDesc="['影片类型']" >
|新话题|新发行|新加入|最想要|高评价|
|-----|------|------|-----|------|
|update|newrelease|newentries|mostwanted|bestrated|
</Route>
### 用户文章
### 影星
<Route author="junfengP" example="/javlibrary/userposts/siccalol" path="/javlibrary/userposts/:uid" :paramsDesc="['用户 id,即用户名称']" />
<Route author="Diygod junfengP" example="/javlibrary/stars/afisw" path="/javlibrary/stars/:sid" :paramsDesc="['影星id,从链接上获取']" />
### 用户
<Route author="Diygod junfengP" example="/javlibrary/users/mangudai/userposts" path="/javlibrary/users/:uid/:utype" :paramsDesc="['用户id,即用户名称','用户选项,见下表']" >
|想要的|看过的|拥有的|发表的文章|
|-----|------|------|-----|
|userwanted|userwatched|userowned|userposts|
</Route>
## Last.fm
+3 -2
View File
@@ -2185,8 +2185,9 @@ router.get('/letterboxd/user/followingdiary/:username', require('./routes/letter
router.get('/netease/ds/:id', require('./routes/netease/ds'));
// javlibrary
router.get('/javlibrary/bestrated', require('./routes/javlibrary/bestrated'));
router.get('/javlibrary/userposts/:uid', require('./routes/javlibrary/userposts'));
router.get('/javlibrary/users/:uid/:utype', require('./routes/javlibrary/users'));
router.get('/javlibrary/videos/:vtype', require('./routes/javlibrary/videos'));
router.get('/javlibrary/stars/:sid', require('./routes/javlibrary/stars'));
// Last.FM
router.get('/lastfm/recent/:user', require('./routes/lastfm/recent'));
+9
View File
@@ -0,0 +1,9 @@
const template = require('./utils');
module.exports = async (ctx) => {
const sid = ctx.params.sid;
ctx.state.data = {
link: `http://www.javlibrary.com/cn/vl_star.php?s=${sid}`,
};
await template(ctx);
};
+1 -2
View File
@@ -1,11 +1,10 @@
const cheerio = require('cheerio');
const dateUtil = require('@/utils/date');
const cloudscraper = require('cloudscraper');
const API = 'http://www.javlibrary.com/cn/userposts.php?u=';
module.exports = async (ctx) => {
const uid = ctx.params.uid;
const link = API + uid;
const link = `http://www.javlibrary.com/cn/userposts.php?u=${uid}`;
const response = await cloudscraper.get(link);
const $ = cheerio.load(response);
const list = $('div#rightcolumn table.comment');
+16
View File
@@ -0,0 +1,16 @@
const template = require('./utils');
const userposts = require('./userposts');
module.exports = async (ctx) => {
const utype = ctx.params.utype;
const uid = ctx.params.uid;
// userposts 页面结构不同,单独写路由
if (utype === 'userposts') {
await userposts(ctx);
} else {
ctx.state.data = {
link: `http://www.javlibrary.com/cn/${utype}.php?u=${uid}`,
};
await template(ctx);
}
};
@@ -1,9 +1,10 @@
const url = require('url');
const cheerio = require('cheerio');
const cloudscraper = require('cloudscraper');
const url = require('url');
module.exports = async (ctx) => {
const link = 'http://www.javlibrary.com/cn/vl_bestrated.php';
// 通过传入不同的ctx.state.data.link 返回javlibrary 不同link的rss
module.exports = async function template(ctx) {
const link = ctx.state.data.link;
const response = await cloudscraper.get(link);
const $ = cheerio.load(response);
const list = $('.videothumblist .video').get();
@@ -31,7 +32,7 @@ module.exports = async (ctx) => {
);
ctx.state.data = {
title: `Javlibrary - 评价最高的影片`,
title: `Javlibrary - ${$('.boxtitle').text()}`,
link: link,
item: items,
};
+9
View File
@@ -0,0 +1,9 @@
const template = require('./utils');
module.exports = async (ctx) => {
const vtype = ctx.params.vtype;
ctx.state.data = {
link: `http://www.javlibrary.com/cn/vl_${vtype}.php`,
};
await template(ctx);
};