Skip to content

Commit

Permalink
Merge branch '1.5.5-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gegehprast committed Dec 31, 2019
2 parents 4f0142b + b331e00 commit 5d18a7f
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shallty",
"version": "1.5.4",
"version": "1.5.5",
"description": "Shallty adalah aplikasi untuk meng-crawl situs fastsub/fanshare Indonesia. Tujuan utamanya adalah untuk melewati berbagai halaman redirect dan mengambil tautan unduh aslinya. Saat ini Shallty telah mendukung crawling untuk Meownime, Samehadaku, Neonime, dan Oploverz. https://shallty.kyuun.id",
"main": "index.js",
"scripts": {
Expand Down
22 changes: 20 additions & 2 deletions services/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,27 @@ class Browser {
return [this.browser, this.browser2]
}

/**
* Create new disabled asset page.
*/
async newOptimizedPage() {
const page = await this.browser.newPage()
await page.setRequestInterception(true)

page.on('request', (req) => {
if (req.resourceType() == 'stylesheet' || req.resourceType() == 'font' || req.resourceType() == 'image') {
req.abort()
} else {
req.continue()
}
})

return page
}

/**
* Create new page with different browser context
* to support multiple sessions
* to support multiple sessions.
* https://github.com/GoogleChrome/puppeteer/issues/85
*/
async newPageWithNewContext() {
Expand All @@ -33,7 +51,7 @@ class Browser {
}

/**
* Close a page, use this function to close a page that has context
* Close a page, use this function to close a page that has context.
*
* @param {Object} page Puppeteer page
*/
Expand Down
10 changes: 5 additions & 5 deletions services/Kiryuu.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Kiryuu {
*
*/
async getMangaList() {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(kiryuu_url + '/manga/?list', {
Expand Down Expand Up @@ -49,7 +49,7 @@ class Kiryuu {
* @param {String} link Manga page url.
*/
async getMangaInfo(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
let cover = null

try {
Expand Down Expand Up @@ -142,7 +142,7 @@ class Kiryuu {
message: 'Browser not ready.'
}

const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(kiryuu_url + link)
Expand Down Expand Up @@ -188,7 +188,7 @@ class Kiryuu {
message: 'Browser not ready.'
}

const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(kiryuu_url + link)
Expand Down Expand Up @@ -238,7 +238,7 @@ class Kiryuu {
*
*/
async getNewReleases() {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(kiryuu_url, {
Expand Down
8 changes: 4 additions & 4 deletions services/Kusonime.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Kusonime {
* Parse and get anime list. Currently support only up to page 2.
*/
async animeList() {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
let animeList = []
Expand Down Expand Up @@ -44,7 +44,7 @@ class Kusonime {
* @param {Number} homePage Home page.
*/
async homePage(homePage = 1) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
const posts = []

try {
Expand Down Expand Up @@ -155,7 +155,7 @@ class Kusonime {
* @param {String} link Episode page url.
*/
async getDownloadLinks(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -227,7 +227,7 @@ class Kusonime {
}

async parseSemawur(link) {
const page = await this.browser.newPageWithNewContext()
const page = await this.newOptimizedPageWithNewContext()

try {
await page.goto(link, {
Expand Down
14 changes: 7 additions & 7 deletions services/Meownime.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Meownime {
* @param link anime page.
*/
async getEpisodes(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
const episodes = new Map

try {
Expand Down Expand Up @@ -75,7 +75,7 @@ class Meownime {
* @param link davinsurance page.
*/
async davinsurance(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -113,7 +113,7 @@ class Meownime {
* @param link meowbox page.
*/
async meowbox(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -185,7 +185,7 @@ class Meownime {
*/
async meowdrive(link) {
let finalUrl
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -226,7 +226,7 @@ class Meownime {
*/
async checkOnGoingPage() {
const anime = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(meownime_url + '/tag/ongoing/', {
Expand Down Expand Up @@ -265,7 +265,7 @@ class Meownime {
*/
async onGoingAnime(link) {
const episodes = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -332,7 +332,7 @@ class Meownime {
* @param link anime page.
*/
async getMovieEpisodes(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
const episodes = []

try {
Expand Down
8 changes: 4 additions & 4 deletions services/Moenime.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Moenime {
* @param {String} show Show type, could be: movie, ongoing or, all.
*/
async animeList(show = 'all') {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(moenime_url + '/daftar-anime-baru/', {
Expand Down Expand Up @@ -165,7 +165,7 @@ class Moenime {
* @param {String} link Anime page url.
*/
async episodes(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
let episodes = {}
Expand Down Expand Up @@ -285,7 +285,7 @@ class Moenime {
*
*/
async newReleases() {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
const anime = []
Expand Down Expand Up @@ -319,7 +319,7 @@ class Moenime {
}

async teknoku(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down
12 changes: 6 additions & 6 deletions services/Neonime.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Neonime {
*/
async checkOnGoingPage() {
const anime = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(neonime_url + '/episode/', {
Expand Down Expand Up @@ -66,7 +66,7 @@ class Neonime {
* Parse and get anime list.
*/
async animeList() {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(neonime_url + '/list-anime/', {
Expand Down Expand Up @@ -97,7 +97,7 @@ class Neonime {
*/
async tvShow(link) {
const episodes = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -136,7 +136,7 @@ class Neonime {
*/
async getEpisodes(link) {
const episodes = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -180,7 +180,7 @@ class Neonime {
async getBatchEpisodes(link) {
const episodes = []
let info1 = false
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -261,7 +261,7 @@ class Neonime {
}
}

const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(link, {
Expand Down
8 changes: 4 additions & 4 deletions services/Oploverz.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Oploverz {
*/
async checkOnGoingPage() {
const anime = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.setUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1')
Expand Down Expand Up @@ -58,7 +58,7 @@ class Oploverz {
*/
async series(link) {
const episodes = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -100,7 +100,7 @@ class Oploverz {
* @param link episode page.
*/
async getDownloadLinks(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
const downloadLinks = []

try {
Expand Down Expand Up @@ -149,7 +149,7 @@ class Oploverz {
}

async hexa(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
try {
link = decodeURIComponent(link)

Expand Down
18 changes: 9 additions & 9 deletions services/Samehadaku.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Samehadaku {
let totalPage
const pageLimit = 3
const episodes = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -107,7 +107,7 @@ class Samehadaku {
*/
async checkOnGoingPage() {
const anime = []
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
await page.goto(samehadaku_url, {
Expand Down Expand Up @@ -154,7 +154,7 @@ class Samehadaku {
* @param link episode page.
*/
async getDownloadLinks(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()
const downloadLinks = []

try {
Expand Down Expand Up @@ -186,7 +186,7 @@ class Samehadaku {
await Util.asyncForEach(list, async item => {
const strong = await item.$('strong')
if (strong && strong != null) {
const quality = this.browser.getPlainProperty(strong, 'innerText')
const quality = await this.browser.getPlainProperty(strong, 'innerText')
const anchors = await item.$$('a')
await Util.asyncForEach(anchors, async anchor => {
const host = await this.browser.getPlainProperty(anchor, 'innerText')
Expand Down Expand Up @@ -230,7 +230,7 @@ class Samehadaku {
*/
async tetew(link, skip = false) {
let final
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -298,7 +298,7 @@ class Samehadaku {
* @param link njiir url.
*/
async njiir(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
let downloadLink, anchor
Expand Down Expand Up @@ -328,7 +328,7 @@ class Samehadaku {
}

async eueSiherp(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand Down Expand Up @@ -373,7 +373,7 @@ class Samehadaku {

//anjay.info
async anjay(link) {
const page = await this.browser.browser.newPage()
const page = await this.browser.newOptimizedPage()

try {
link = decodeURIComponent(link)
Expand All @@ -385,7 +385,7 @@ class Samehadaku {
timeout: 30000
})

await Util.sleep(10000)
await Util.sleep(13000)
await page.waitForSelector('div.to > a')
await page.click('div.to > a')
await page.waitForSelector('#showlink')
Expand Down
Loading

0 comments on commit 5d18a7f

Please sign in to comment.