diff --git a/lib/routes/mirror/entries.js b/lib/routes/mirror/entries.js index 8b975b2ae1..7a0d2e6b82 100644 --- a/lib/routes/mirror/entries.js +++ b/lib/routes/mirror/entries.js @@ -6,10 +6,10 @@ module.exports = async (ctx) => { let link; let subDomain = 0; if (id.endsWith('.eth') || id.length === 42 || id.length === 40) { - link = 'https://mirror.xyz/' + id; + link = 'https://mirror.xyz/' + id; } else { - link = 'https://' + id + '.mirror.xyz'; - subDomain = 1; + link = 'https://' + id + '.mirror.xyz'; + subDomain = 1; } const response = await got({ @@ -23,25 +23,41 @@ module.exports = async (ctx) => { const author = $('div#__next > div.GlobalNavigation > div.GlobalNavigationContainer > div > div > div > div > div > a').text(); // 标题 - const article = $('h1').map(function() { - return $(this).text(); - }).get(); + const article = $('h1') + .map(function () { + return $(this).text(); + }) + .get(); // 地址 - const addr = $('h1').parent().parent().parent().map(function() { - return $(this).attr('href'); - }).get(); + const addr = $('h1') + .parent() + .parent() + .parent() + .map(function () { + return $(this).attr('href'); + }) + .get(); // 发布日期 - const date = $('div#__next > div > div > div > div > div > div > div > div > div').map(function() { - return $(this).text(); - }).get(); + const date = $('div#__next > div > div > div > div > div > div > div > div > div') + .map(function () { + return $(this).text(); + }) + .get(); // 摘要 - const des = $('h1').parent().parent().parent().parent().next().next().map(function() { - return $(this).text(); - }).get(); - + const des = $('h1') + .parent() + .parent() + .parent() + .parent() + .next() + .next() + .map(function () { + return $(this).text(); + }) + .get(); const items = []; article.forEach((item, index) => { @@ -56,9 +72,9 @@ module.exports = async (ctx) => { const title = author + ' - Mirror'; ctx.state.data = { - title, - link, - allowEmpty: true, - item: items, + title, + link, + allowEmpty: true, + item: items, }; -}; \ No newline at end of file +};