feat(rutor): category rutor

This commit is contained in:
Alexey Kasyanchuk 2018-09-02 22:05:39 +03:00
parent 0521b7ea02
commit 429263e61e
2 changed files with 14 additions and 1 deletions

View File

@ -127,11 +127,23 @@ module.exports = class Rutor
if(!topicTitle)
return
let contentCategory
$('#details tr').each(function(i, elem) {
const row = $(this)
const field = row.find('td.header').text()
if(field == 'Категория')
{
contentCategory = row.find('td').next().text().trim()
}
});
return {
name: topicTitle,
poster: $('#details tbody img').attr('src'),
description: $('#details tbody').first().text(),
rutorThreadId: parseInt(id)
rutorThreadId: parseInt(id),
contentCategory
}
}

View File

@ -15,6 +15,7 @@ describe("rutor", () => {
const data = await rutor.findHash('158448f6afbedb079aaf3c4695fb43e7dfa54515')
assert.equal(data.name, 'Наруто: Ураганные Хроники / Naruto Shippuuden Movie [4 фильм] (2007) DVDRip')
assert.equal(data.rutorThreadId, 5850)
assert.equal(data.contentCategory, 'Аниме')
})
it("notFound", async function() {