This commit is contained in:
AniDL 2020-06-03 13:19:16 +03:00
parent ef1635192a
commit 7c058642fd
6 changed files with 97 additions and 23 deletions

44
.github/workflows/release-win64.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Release Build Win64
on:
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1.4.2
with:
node-version: 12.15.0
- name: Install Node modules
run: npm install
- name: Make build
run: npm run build-win64
- name: Get name from package.json
run: |
test -n "$(node -p -e "require('./package.json').name")" &&
echo "::set-env name=PACKAGE_NAME::$(node -p -e "require('./package.json').name")" || exit 1
- name: Get version from package.json
run: |
test -n "$(node -p -e "require('./package.json').version")" &&
echo "::set-env name=PACKAGE_VERSION::$(node -p -e "require('./package.json').version")" || exit 1
- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-win64.7z
asset_path: ./_builds/${{ env.PACKAGE_NAME }}-${{ env.PACKAGE_VERSION }}-win64.7z
asset_content_type: application/x-7z-compressed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -1,13 +1,23 @@
## Change Log
### 4.6.0 (2020/06/03)
- Bug fixes and improvements
#### Known issues:
- Proxy not supported
### 4.5.1 (2020/03/10)
- Better binary files handling
- Binary build for windows
- Known bug: Proxy not working
#### Known issues:
- Proxy not supported
### 4.5.0 (2020/01/21)
- Resume downloading
- Known bug: Proxy not working
#### Known issues:
- Proxy not supported
### 4.4.2 (2019/07/21)
- Better proxy handling for stream download

40
funi.js
View file

@ -13,9 +13,7 @@ console.log(`\n=== Funimation Downloader NX ${packageJson.version} ===\n`);
const api_host = 'https://prod-api-funimationnow.dadcdigital.com/api';
// request
const got = require('got').extend({
headers: { 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0' },
});
const got = require('got');
// modules extra
const yaml = require('yaml');
@ -492,7 +490,7 @@ async function downloadStreams(){
plMaxLayer = plMaxLayer < plLayerId ? plLayerId : plMaxLayer;
// set urls and servers
let plUrlDl = s.uri;
let plServer = plUrlDl.split('/')[2];
let plServer = new URL(plUrlDl).host;
if(!plServerList.includes(plServer)){
plServerList.push(plServer);
}
@ -522,12 +520,16 @@ async function downloadStreams(){
for(let s of mainServersList){
if(plServerList.includes(s)){
plServerList.splice(plServerList.indexOf(s),1);
plServerList.splice(plServerList.indexOf(s), 1);
plServerList.unshift(s);
break;
}
}
if(typeof argv.q == 'object' && argv.q.length > 1){
argv.q = argv.q[argv.q.length-1];
}
argv.q = argv.q < 1 || argv.q > plMaxLayer ? plMaxLayer : argv.q;
let plSelectedServer = plServerList[argv.x-1];
@ -571,7 +573,7 @@ async function downloadStreams(){
if (argv.proxy && !argv.ssp) {
try {
proxyHLS = {};
proxyHLS.url = buildProxyUrl(argv.proxy,argv['proxy-auth']);
proxyHLS.url = buildProxyUrl(argv.proxy, argv['proxy-auth']);
}
catch(e){
console.log(`\n[WARN] Not valid proxy URL${e.input?' ('+e.input+')':''}!`);
@ -629,7 +631,10 @@ async function downloadStreams(){
return;
}
if(!fs.statSync(`${path.join(cfg.dir.content, fnOutput)}.ts`).isFile()){
let muxTrg = path.join(cfg.dir.content, fnOutput);
let tshTrg = path.join(cfg.dir.trash, fnOutput);
if(!fs.existsSync(`${muxTrg}.ts`) || !fs.statSync(`${muxTrg}.ts`).isFile()){
console.log('\n[INFO] TS file not found, skip muxing video...\n');
return;
}
@ -660,9 +665,6 @@ async function downloadStreams(){
argv.ftag = argv.ftag ? argv.ftag : argv.a;
argv.ftag = shlp.cleanupFilename(argv.ftag);
let muxTrg = path.join(cfg.dir.content, fnOutput);
let tshTrg = path.join(cfg.dir.trash, fnOutput);
// select muxer
if(!argv.mp4 && usableMKVmerge){
// mux to mkv
@ -721,7 +723,12 @@ async function downloadStreams(){
// get data from url
async function getData(options){
let gOptions = { url: options.url, headers: {} };
let gOptions = {
url: options.url,
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0',
}
};
if(options.baseUrl){
gOptions.prefixUrl = options.baseUrl;
gOptions.url = gOptions.url.replace(/^\//,'');
@ -741,6 +748,17 @@ async function getData(options){
if(options.dinstid){
gOptions.headers.devicetype = 'Android Phone';
}
// debug
gOptions.hooks = {
beforeRequest: [
(options) => {
if(argv.debug){
console.log('[DEBUG] GOT OPTIONS:');
console.log(options);
}
}
]
};
if(options.useProxy && argv.proxy){
try{
const ProxyAgent = require('proxy-agent');

View file

@ -57,7 +57,7 @@ const nodeVer = '-12.15.0';
fs.copySync('./config/bin-path.yml', `${buildDir}/config/bin-path.yml`);
fs.copySync('./config/cli-defaults.yml', `${buildDir}/config/cli-defaults.yml`);
fs.copySync('./config/dir-path.yml', `${buildDir}/config/dir-path.yml`);
fs.copySync('./cmd-here.bat', `${buildDir}/cmd-here.bat`);
fs.copySync('./modules/cmd-here.bat', `${buildDir}/cmd-here.bat`);
fs.copySync('./docs/', `${buildDir}/docs/`);
fs.copySync('./LICENSE.md', `${buildDir}/docs/LICENSE.md`);
if(fs.existsSync(`${buildsDir}/${buildFull}.7z`)){

View file

@ -1,7 +1,7 @@
{
"name": "funimation-downloader-nx",
"short_name": "funi",
"version": "4.5.1",
"version": "4.6.0",
"description": "Download videos from Funimation via cli.",
"keywords": [
"download",
@ -25,18 +25,18 @@
"main": "funi.js",
"dependencies": {
"form-data": "^3.0.0",
"got": "^10.6.0",
"hls-download": "^2.3.2",
"lookpath": "^1.0.5",
"m3u8-parsed": "^1.2.0",
"got": "^11.2.0",
"hls-download": "^2.4.1",
"lookpath": "^1.0.6",
"m3u8-parsed": "^1.3.0",
"proxy-agent": "^3.1.1",
"sei-helper": "^3.3.0",
"ttml2srt": "^1.1.0",
"yaml": "^1.8.0",
"yargs": "^15.3.0"
"ttml2srt": "^1.2.0",
"yaml": "^1.10.0",
"yargs": "^15.3.1"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"fs-extra": "^9.0.0",
"nexe": "^3.3.2",
"removeNPMAbsolutePaths": "^2.0.0"
},
@ -44,6 +44,8 @@
"build-win64": "node modules/build win64",
"build-linux64": "node modules/build linux64",
"build-macos64": "node modules/build macos64",
"eslint": "eslint *.js modules",
"eslint-fix": "eslint *.js modules --fix",
"test": "echo \"Error: no test specified\" && exit 1"
}
}