-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scraper):Optimized and added avsox information source
- Loading branch information
Showing
11 changed files
with
102 additions
and
465 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import Store from 'electron-store'; | ||
|
||
const store = new Store(); | ||
const store = new Store({ | ||
defaults: { | ||
scene: ['movie', 'normal'], | ||
tags: ['无'] | ||
} | ||
}); | ||
|
||
export default store; |
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
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,68 @@ | ||
import request from 'request-promise'; | ||
import cheerio from 'cheerio'; | ||
import MovieModel from '../core/model'; | ||
import { MediaKeys } from '@types'; | ||
|
||
export default { | ||
head: async (queryString: string): Promise<any> => { | ||
const movieModel = new MovieModel(); | ||
const encodedQueryString = encodeURIComponent(queryString); | ||
const searchPage = await request( | ||
`https://avsox.asia/cn/search/${encodedQueryString}` | ||
); | ||
const infoPageUrl = cheerio | ||
.load(searchPage)('.movie-box') | ||
.attr('href') | ||
.replace(/https:\/\//, 'http://'); | ||
const $ = cheerio.load(await request(infoPageUrl)); | ||
movieModel.setModel({ | ||
title: { | ||
_text: $('h3') | ||
.text() | ||
.trim() | ||
}, | ||
premiered: { | ||
_text: $('.info>p:nth-child(2)') | ||
.text() | ||
.split(': ')[1] | ||
.trim() | ||
}, | ||
art: { | ||
poster: { | ||
_text: $('.bigImage') | ||
.attr('href') | ||
.trim() | ||
.replace(/https:\/\//, 'http://') | ||
}, | ||
fanart: { | ||
_text: $('.bigImage') | ||
.attr('href') | ||
.trim() | ||
.replace(/https:\/\//, 'http://') | ||
} | ||
}, | ||
actor: $('#avatar-waterfall .avatar-box img') | ||
.map((index, $actor) => ({ | ||
name: { _text: $actor.attribs.title.trim() }, | ||
thumb: { | ||
_text: $actor.attribs.src.trim().replace(/https:\/\//, 'http://') | ||
} | ||
})) | ||
.toArray(), | ||
uniqueid: [ | ||
{ | ||
_attributes: { type: '1', default: true }, | ||
_text: $('.info>p:nth-child(1)>span:nth-child(2)') | ||
.text() | ||
.trim() | ||
} | ||
], | ||
genre: $('.info .genre>a') | ||
.map((index, $genre) => ({ _text: $genre.firstChild.data.trim() })) | ||
.toArray() | ||
}); | ||
return movieModel; | ||
}, | ||
name: 'avsox', | ||
type: [MediaKeys.Movie, MediaKeys.Gentleman] | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { ToolHead } from '@types'; | ||
import tmdb from './tmdb'; | ||
import javbus from './javbus'; | ||
import avsox from './avsox'; | ||
|
||
export default [tmdb, javbus]; | ||
const heads: ToolHead[] = [tmdb, javbus, avsox]; | ||
export default heads; |
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