-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
48 lines (39 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
const got = require('got')
const BASE_URL = `https://www.animefreak.tv/` //reliable site
function getEpisodeUrl (baseUrl = BASE_URL, name, epiNum) {
if (typeof name === 'string' && typeof epiNum === 'number') {
return `${baseUrl}/watch/${name}-episode-${epiNum}-english-dubbed-online-free`
} else {
return `${baseUrl}`
}
}
function getShowUrl (baseUrl = BASE_URL, name) {
if (typeof name === 'string') {
return `${baseUrl}/watch/${name}-episode-${epiNum}-english-dubbed-online-free`
} else {
return `${baseUrl}`
}
}
// @todo: full list of episodes accessable through if of "book-navigation-${release}" html element. use getElementById and parse
function getLatestEpisode () {
if (typeof name === 'string') {
// go to `${baseUrl}/watch/${name}-english-dubbed-online-free`
// parse "book-navigation-${release}" html element
} else {
return `https://www.animefreak.tv/`
}
}
function getReleaseId(name) {
// @todo
}
function getNextEpisode (baseUrl = BASE_URL, name, currentEpiNum) {
if (typeof name === 'string' && typeof epiNum === 'number') {
return `${baseUrl}/watch/${name}-episode-${currentEpiNum + 1}-english-dubbed-online-free`
}
}
function getVideoUrl (baseUrl = BASE_URL, name, currentEpiNum) {
// @todo: get the actual video URL
}
exports.getUrl = getUrl;
exports.getNextEpisode = getNextEpisode;