-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(change): expose most of the scraper code
- bugs were occurring in the scraper code and it felt weird to fix them and not be able to commit or version control that data - in the future, when multiple providers are supported and the API is somewhat stable, probably want to split this out into its own library / sdk and have the app depend on the SDK instead of doing it's own parsing - still gitignore site names and URLs for now - and rename exposed files to numbers instead of names for now - might use acronyms or something in the future for multi-provider support and letting the user choose providers
- Loading branch information
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# don't commit site names or URLs for now | ||
allDrivers.js | ||
driver*URLS.js |
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,52 @@ | ||
export { searchURL, latestURL } from './driver1URLs.js' | ||
|
||
export function getSearch ($) { | ||
return $('.post-list li') | ||
.map((index, el) => ({ | ||
link: $(el).find('a').attr('href'), | ||
title: $(el).find('img').attr('title'), | ||
cover: $(el).find('img').attr('src') | ||
})) | ||
.get() | ||
} | ||
|
||
export function getLatest ($) { | ||
return $('.post') | ||
.map((index, el) => ({ | ||
link: $(el).find('a').attr('href'), | ||
title: $(el).find('img').attr('title'), | ||
cover: $(el).find('img').attr('src'), | ||
release: $(el).find('em').text() | ||
})) | ||
.get() | ||
} | ||
|
||
export function getChapters ($) { | ||
const title = $('.manga-detail-top .title').text().trim() | ||
const chapters = $('.chlist a') | ||
.map((index, el) => { | ||
return { | ||
link: $(el).attr('href').replace('//', 'http://'), | ||
title: $(el).text().match(/[0-9]+/)[0] || '0', | ||
date: new Date($(el).find(':not(.newch)').text()) | ||
} | ||
}) | ||
.get() | ||
const tags = $('.manga-genres li') | ||
.map((index, el) => $(el).text().trim()) | ||
.get() | ||
const summary = $('.manga-summary').text().trim() | ||
return { title, chapters, tags, summary } | ||
} | ||
|
||
export function getPages ($) { | ||
return $('.mangaread-page option') | ||
.map((index, el) => ({ | ||
link: $(el).attr('value').replace('//', 'http://') | ||
})) | ||
.get() | ||
} | ||
|
||
export function getImage ($) { | ||
return $('#viewer img').attr('src') | ||
} |