-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** | ||
* @author IITII <ccmejx@gmail.com> | ||
* @date 2023/11/28 | ||
*/ | ||
'use strict' | ||
|
||
const path = require('path') | ||
const {getImgArr, arrToAbsUrl, droppedPage, urlTextsToAbs} = require('../dl_utils') | ||
const {titleFormat} = require('../../utils') | ||
const {uniq} = require('lodash') | ||
|
||
async function getImageArray(url) { | ||
let res = await getImgArr(url, handle_dom) | ||
let m = url.match(/photos-index-aid-(\d+).html/) | ||
if (!m) { | ||
m = url.match(/photos-slide-aid-(\d+).html/) | ||
} | ||
if (m) { | ||
let url1 = `https://www.hentaicomic.ru/photos-gallery-aid-${m[1]}.html` | ||
let res1 = await getImgArr(url1, handle_dom) | ||
res.imgs = res.imgs.concat(res1.imgs) | ||
res.cost += res1.cost | ||
} | ||
return res | ||
} | ||
|
||
async function handle_dom($, original) { | ||
let title, imgs, otherPages, related, tags, denyPages, urls, external | ||
denyPages = '«,»'.split(',') | ||
|
||
title = $('title').text()?.replace(/ ?- ?列表 ?- ?紳士漫畫-專註分享漢化本子\|邪惡漫畫/, '') | ||
imgs = $.text()?.split('\n').filter(_ => _.includes('imglist')).filter(_ => _.includes('fast_img_host'))[0] | ||
// imgs = imgs.replace(/^document.writeln\("(\s+)?/, '').replace(/;?"\);/, '') | ||
imgs = imgs?.split('},').map(_ => { | ||
let m = _.match(/"\/\/([\s\S]+)\\",/) | ||
return m ? m[1] : '' | ||
}).filter(_ => !!_).map(_ => `http://${_}`) | ||
|
||
title = titleFormat(title) | ||
imgs = uniq(imgs) | ||
imgs = arrToAbsUrl(imgs, original) | ||
|
||
const res = {title, imgs,} | ||
return Promise.resolve(res) | ||
} | ||
|
||
let url = 'https://www.hentaicomic.ru/photos-slide-aid-227644.html' | ||
// url = 'https://www.hentaicomic.ru/photos-gallery-aid-227644.html' | ||
getImageArray(url).then(console.log).catch(console.error) | ||
|
||
module.exports = { | ||
getImageArray, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @author IITII <ccmejx@gmail.com> | ||
* @date 2022/11/03 | ||
*/ | ||
'use strict' | ||
|
||
const {get_dom, getTagImgArr, urlTextsToAbs} = require('../dl_utils') | ||
const {titleFormat} = require('../../utils') | ||
const pic = require('./HentaiComic.js') | ||
|
||
module.exports = { | ||
getTagUrls, | ||
getImageArray, | ||
} | ||
|
||
async function getTagUrls(url) { | ||
return get_dom(url, handle_dom) | ||
} | ||
|
||
async function getImageArray(url) { | ||
return getTagImgArr(url, getTagUrls, pic.getImageArray) | ||
} | ||
|
||
async function handle_dom($, original) { | ||
let title, posters, url_texts, urls, texts | ||
|
||
title = $('title').text()?.replace(/搜索[::] ?/, '') | ||
title = title?.replace(/ ?- ?紳士漫畫-專註分享漢化本子\|邪惡漫畫/, '') | ||
// title = title.replace('') | ||
url_texts = $('.gallary_wrap .pic_box img') | ||
urls = $('.gallary_wrap .pic_box a').map((i, el) => el.attribs['href']).get() | ||
url_texts = url_texts.map((i, el) => { | ||
let poster = el.attribs['data-src'] || el.attribs['src'], | ||
text = el.attribs.alt, | ||
url = urls[i] | ||
text = text.replace(/<\/?em>/g, '') | ||
url = url.match(/photos-index-aid-(\d+).html/) | ||
url = url ? `https://www.hentaicomic.ru/photos-slide-aid-${url[1]}.html` : urls[i] | ||
return {url, text, poster} | ||
}).get() | ||
|
||
title = titleFormat(title) | ||
url_texts = urlTextsToAbs(url_texts, original, true) | ||
const res = {title, imgs: url_texts} | ||
return Promise.resolve(res) | ||
} | ||
|
||
let url = 'https://www.hentaicomic.ru/search/?q=Kitkatkitty&f=_all&s=create_time_DESC&syn=yes' | ||
// url = 'https://www.hentaicomic.ru/albums-index-cate-3.html' | ||
getTagUrls(url).then(console.log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters