diff --git a/lib/v2/javbus/index.js b/lib/v2/javbus/index.js index 48f00278cc..786d3e770e 100644 --- a/lib/v2/javbus/index.js +++ b/lib/v2/javbus/index.js @@ -4,6 +4,11 @@ const { parseDate } = require('@/utils/parse-date'); const { art } = require('@/utils/render'); const path = require('path'); +const toSize = (raw) => { + const matches = raw.match(/(\d+(\.\d+)?)(\w+)/); + return matches[3] === 'GB' ? matches[1] * 1024 : matches[1]; +}; + module.exports = async (ctx) => { const isWestern = /^\/western/.test(ctx.path); @@ -19,7 +24,7 @@ module.exports = async (ctx) => { const $ = cheerio.load(response.data); let items = $('.movie-box') - .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30) + .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 50) .toArray() .map((item) => { item = $(item); @@ -98,11 +103,12 @@ module.exports = async (ctx) => { link: td.first().attr('href'), size: td.eq(1).text().trim(), date: td.last().text().trim(), + score: content(tr).find('a').length ** 8 * toSize(td.eq(1).text().trim()), }; }); if (magnets) { - item.enclosure_url = magnets[0].link; + item.enclosure_url = magnets.sort((a, b) => b.score - a.score)[0].link; item.enclosure_type = 'application/x-bittorrent'; } } catch (e) { diff --git a/lib/v2/javbus/templates/description.art b/lib/v2/javbus/templates/description.art index 632a3e5cfd..8f05fc28ba 100644 --- a/lib/v2/javbus/templates/description.art +++ b/lib/v2/javbus/templates/description.art @@ -9,9 +9,20 @@ {{/if}}

磁力連結投稿

+ + + + + + {{each magnets magnet}} -
  • {{ magnet.title }} [{{ magnet.size }}] ({{ magnet.date }})
  • + + + + + {{/each}} +
    磁力名稱檔案大小分享日期
    {{ magnet.title }}{{ magnet.size }}{{ magnet.date }}

    樣品圖像

    {{each thumbs}}