Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions controllers/MainController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const scraperjs = require('scraperjs')
class MainController {
home({ params: { page } }, req) {
page = typeof page === 'undefined' ? '' : page === '1' ? '' : `page/${page.toString()}/`
scraperjs.StaticScraper.create(`https://samehadaku.vip/${page}`).scrape(
scraperjs.StaticScraper.create(`https://v1.samehadaku.how/${page}`).scrape(
async ($) => {
const obj = {}
obj.season = $('.animposx')
Expand All @@ -15,7 +15,7 @@ class MainController {
linkId: $(this)
.find('a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
image: $(this)
.find('a .content-thumb img')
Expand Down Expand Up @@ -77,7 +77,7 @@ class MainController {
? ''
: `page/${page.toString()}/`
scraperjs.StaticScraper.create(
`https://samehadaku.vip/blog/${page}`,
`https://v1.samehadaku.how/blog/${page}`,
).scrape(($) => {
const blog = {}
blog.blog = $('.box-blog')
Expand All @@ -90,7 +90,7 @@ class MainController {
linkId: $(this)
.find('.img a')
.attr('href')
.replace('https://samehadaku.vip/blog/', '')
.replace('https://v1.samehadaku.how/blog/', '')
.replace('/', '')
.trim(),
image: $(this).find('.img a img').attr('src'),
Expand All @@ -103,7 +103,7 @@ class MainController {
}

readblog({ params: { id } }, req) {
const page = `https://samehadaku.vip/blog/${id}`
const page = `https://v1.samehadaku.how/blog/${id}`

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -156,7 +156,7 @@ class MainController {
}

tag({ params: { tag } }, req) {
const page = `https://samehadaku.vip/tag/${tag}`
const page = `https://v1.samehadaku.how/tag/${tag}`

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand All @@ -181,7 +181,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -192,7 +192,7 @@ class MainController {
}

blogcategory({ params: { category } }, req) {
const page = `https://samehadaku.vip/blog-category/${category}`
const page = `https://v1.samehadaku.how/blog-category/${category}`

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand All @@ -209,7 +209,7 @@ class MainController {
linkId: $(this)
.find('.img a')
.attr('href')
.replace('https://samehadaku.vip/blog/', '')
.replace('https://v1.samehadaku.how/blog/', '')
.replace('/', '')
.trim(),
image: $(this).find('.img a img').attr('src'),
Expand All @@ -222,7 +222,7 @@ class MainController {
}

blogCategoryByPage({ params: { category, page } }, req) {
const pager = `https://samehadaku.vip/blog-category/${category}/page/${page}`
const pager = `https://v1.samehadaku.how/blog-category/${category}/page/${page}`

scraperjs.StaticScraper.create(pager).scrape(($) => {
const data = {}
Expand All @@ -239,7 +239,7 @@ class MainController {
linkId: $(this)
.find('.img a')
.attr('href')
.replace('https://samehadaku.vip/blog/', '')
.replace('https://v1.samehadaku.how/blog/', '')
.replace('/', '')
.trim(),
image: $(this).find('.img a img').attr('src'),
Expand All @@ -252,14 +252,14 @@ class MainController {
}

daftarGenre(_, req) {
scraperjs.StaticScraper.create('https://samehadaku.vip/').scrape(($) => {
scraperjs.StaticScraper.create('https://v1.samehadaku.how/').scrape(($) => {
const obj = {}
obj.daftar_genere = $('.genre > li').map(function () {
const span = $(this).find('span').text()
return {
nama_genre: $(this).text().replace(span, ''),
link: $(this).find('a').attr('href'),
linkid: $(this).find('a').attr('href').replace('https://samehadaku.vip/genre/', ''),
linkid: $(this).find('a').attr('href').replace('https://v1.samehadaku.how/genre/', ''),
total: span,
}
}).get()
Expand All @@ -268,7 +268,7 @@ class MainController {
}

anime({ params: { id } }, req) {
const page = `https://samehadaku.vip/anime/${id}/`
const page = `https://v1.samehadaku.how/anime/${id}/`
scraperjs.StaticScraper.create(page).scrape(async ($) => {
const data = {}

Expand Down Expand Up @@ -550,7 +550,7 @@ class MainController {
id: $(this)
.find('.epsright .eps a')
.attr('href')
.replace('https://samehadaku.vip/', ''),
.replace('https://v1.samehadaku.how/', ''),
}
})
.get()
Expand Down Expand Up @@ -586,7 +586,7 @@ class MainController {
)
})

await scraperjs.StaticScraper.create('https://samehadaku.vip/').scrape(
await scraperjs.StaticScraper.create('https://v1.samehadaku.how/').scrape(
async ($) => {
data.latest = await Promise.all(
$('.post-show ul li')
Expand Down Expand Up @@ -630,7 +630,7 @@ class MainController {
}

async readanime({ params: { link } }, req) {
const page = `https://samehadaku.vip/${link}/`
const page = `https://v1.samehadaku.how/${link}/`

scraperjs.StaticScraper.create(page).scrape(async ($) => {
const data = {}
Expand Down Expand Up @@ -721,7 +721,7 @@ class MainController {
}

search({ params: { title } }, req) {
const page = `https://samehadaku.vip/?s=${title}`
const page = `https://v1.samehadaku.how/?s=${title}`

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -753,7 +753,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -764,7 +764,7 @@ class MainController {
}

searchByPage({ params: { title, page } }, req) {
const pager = `https://samehadaku.vip/page/${page}/?s=${title}`
const pager = `https://v1.samehadaku.how/page/${page}/?s=${title}`

scraperjs.StaticScraper.create(pager).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -796,7 +796,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -807,7 +807,7 @@ class MainController {
}

season(_, req) {
const page = 'https://samehadaku.vip/season/spring-2020/'
const page = 'https://v1.samehadaku.how/season/spring-2020/'

scraperjs.StaticScraper.create(page)
.scrape(($) => {
Expand Down Expand Up @@ -850,7 +850,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -859,7 +859,7 @@ class MainController {
return data
})
.then((data) => {
const page = 'https://samehadaku.vip/season/spring-2020/page/2/'
const page = 'https://v1.samehadaku.how/season/spring-2020/page/2/'

scraperjs.StaticScraper.create(page).scrape(($) => {
const results = $('.relat .animpost')
Expand Down Expand Up @@ -893,7 +893,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -907,7 +907,7 @@ class MainController {
}

date(_, req) {
const page = 'https://samehadaku.vip/jadwal-rilis/'
const page = 'https://v1.samehadaku.how/jadwal-rilis/'

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -945,7 +945,7 @@ class MainController {
linkId: $(this)
.find('.animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -959,7 +959,7 @@ class MainController {
}

listWithoutPage(_, req) {
const page = 'https://samehadaku.vip/daftar-anime/'
const page = 'https://v1.samehadaku.how/daftar-anime/'

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -994,7 +994,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -1005,7 +1005,7 @@ class MainController {
}

listWithPage({ params: { page } }, req) {
const inPage = `https://samehadaku.vip/daftar-anime/page/${page}/`
const inPage = `https://v1.samehadaku.how/daftar-anime/page/${page}/`

scraperjs.StaticScraper.create(inPage).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -1040,7 +1040,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand All @@ -1051,7 +1051,7 @@ class MainController {
}

searchByGenre({ params: { genre } }, req) {
const page = `https://samehadaku.vip/genre/${genre}`
const page = `https://v1.samehadaku.how/genre/${genre}`

scraperjs.StaticScraper.create(page).scrape(($) => {
const data = {}
Expand Down Expand Up @@ -1086,7 +1086,7 @@ class MainController {
linkId: $(this)
.find('.animepost .animposx a')
.attr('href')
.replace('https://samehadaku.vip/anime/', '')
.replace('https://v1.samehadaku.how/anime/', '')
.replace('/', ''),
}
})
Expand Down