From fa0721796a406d4bbcb1b5003ea9b818d1e5e2ce Mon Sep 17 00:00:00 2001 From: Dec-F Date: Sun, 29 Sep 2019 17:27:11 +0800 Subject: [PATCH] fix(scraper): fix file name case fix #4 --- app/scraper/core/index.ts | 2 +- app/scraper/dd.json | 6 ------ app/scraper/douban.ts | 28 ---------------------------- 3 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 app/scraper/dd.json delete mode 100644 app/scraper/douban.ts diff --git a/app/scraper/core/index.ts b/app/scraper/core/index.ts index e5765ff..96b17e4 100644 --- a/app/scraper/core/index.ts +++ b/app/scraper/core/index.ts @@ -1,7 +1,7 @@ // import douban from '../douban'; import { writeFile, mkdirp } from 'fs-extra'; -import javbus from '../javBus'; +import javbus from '../javbus'; import { downloadImg, defaultRegExp, emitter } from '../../utils'; import { EventType } from '@types'; diff --git a/app/scraper/dd.json b/app/scraper/dd.json deleted file mode 100644 index 327d79a..0000000 --- a/app/scraper/dd.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "1": "118106_3xplanet_1ondo_082318", - "2": "118106_3xplanet_1Pondo_082318_733" - } -] diff --git a/app/scraper/douban.ts b/app/scraper/douban.ts deleted file mode 100644 index 07bab5c..0000000 --- a/app/scraper/douban.ts +++ /dev/null @@ -1,28 +0,0 @@ -import puppeteer from 'puppeteer'; -import cheerio from 'cheerio'; -import MovieModel from './core/model'; - -export default async (queryString: string): Promise => { - const movieModel = new MovieModel(); - const encodedQueryString = encodeURIComponent(queryString); - const browser = await puppeteer.launch({ headless: false }); - const page = await browser.newPage(); - await page.goto( - `https://movie.douban.com/subject_search?search_text=${encodedQueryString}`, - { waitUntil: 'networkidle2' } - ); - await page.click('.item-root>a'); - await page.waitForSelector('#content'); - const html = await page.$eval('#content', el => el.outerHTML); - const $ = cheerio.load(html); - movieModel.setModel({ - title: $('h1>span:nth-child(1)').text(), - year: $('h1 .year').text(), - art: { poster: $('#mainpic>a>img').attr('src') }, - actor: $('#info>.actor>.attrs>a') - .map((index, $actor) => ({ name: $actor.children[0].data })) - .toArray(), - uniqueid: [{ _attributes: { type: '1', default: true }, _text: 'text' }] - }); - return movieModel.getXML(); -};