Compare commits

..

1 commit

Author SHA1 Message Date
KasumiDev
cfecc59225
Add check for (NC) in parseSelect 2024-07-11 12:19:45 +02:00
7 changed files with 22 additions and 12 deletions

View file

@ -27,6 +27,6 @@ jobs:
github-token: ${{ github.token }} github-token: ${{ github.token }}
push: ${{ github.ref == 'refs/heads/master' }} push: ${{ github.ref == 'refs/heads/master' }}
tags: | tags: |
"multidl/multi-downloader-nx:latest" "izuco/multi-downloader-nx:latest"
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}

View file

@ -61,6 +61,6 @@ jobs:
github-token: ${{ github.token }} github-token: ${{ github.token }}
push: true push: true
tags: | tags: |
"multidl/multi-downloader-nx:${{ github.event.release.tag_name }}" "izuco/multi-downloader-nx:${{ github.event.release.tag_name }}"
- name: Image digest - name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }} run: echo ${{ steps.docker_build.outputs.digest }}

14
adn.ts
View file

@ -204,6 +204,8 @@ export default class AnimationDigitalNetwork implements ServiceClass {
return { isOk: false, reason: new Error('Authentication failed') }; return { isOk: false, reason: new Error('Authentication failed') };
} }
this.token = await authReq.res.json(); this.token = await authReq.res.json();
const cookies = this.parseCookies(authReq.res.headers.get('Set-Cookie'));
this.token.refreshToken = cookies.adnrt;
yamlCfg.saveADNToken(this.token); yamlCfg.saveADNToken(this.token);
console.info('Authentication Success'); console.info('Authentication Success');
return { isOk: true, value: undefined }; return { isOk: true, value: undefined };
@ -214,16 +216,19 @@ export default class AnimationDigitalNetwork implements ServiceClass {
method: 'POST', method: 'POST',
headers: { headers: {
Authorization: `Bearer ${this.token.accessToken}`, Authorization: `Bearer ${this.token.accessToken}`,
'X-Access-Token': this.token.accessToken, 'Cookie': `adnrt=${this.token.refreshToken}`,
'content-type': 'application/json' 'X-Access-Token': this.token.accessToken
}, },
body: JSON.stringify({refreshToken: this.token.refreshToken}) body: '{}'
}); });
if(!authReq.ok || !authReq.res){ if(!authReq.ok || !authReq.res){
console.error('Token refresh failed!'); console.error('Token refresh failed!');
return { isOk: false, reason: new Error('Token refresh failed') }; return { isOk: false, reason: new Error('Token refresh failed') };
} }
this.token = await authReq.res.json(); this.token = await authReq.res.json();
const cookies = this.parseCookies(authReq.res.headers.get('Set-Cookie'));
//this.token.refreshtoken = this.token.refreshToken;
this.token.refreshToken = cookies.adnrt;
yamlCfg.saveADNToken(this.token); yamlCfg.saveADNToken(this.token);
return { isOk: true, value: undefined }; return { isOk: true, value: undefined };
} }
@ -458,8 +463,7 @@ export default class AnimationDigitalNetwork implements ServiceClass {
const configReq = await this.req.getData(`https://gw.api.animationdigitalnetwork.fr/player/video/${data.id}/configuration`, { const configReq = await this.req.getData(`https://gw.api.animationdigitalnetwork.fr/player/video/${data.id}/configuration`, {
headers: { headers: {
Authorization: `Bearer ${this.token.accessToken}`, Authorization: `Bearer ${this.token.accessToken}`
'X-Target-Distribution': this.locale
} }
}); });
if(!configReq.ok || !configReq.res){ if(!configReq.ok || !configReq.res){

View file

@ -1,4 +1,4 @@
# multi-downloader-nx (5.1.5v) # multi-downloader-nx (5.1.4v)
If you find any bugs in this documentation or in the program itself please report it [over on GitHub](https://github.com/anidl/multi-downloader-nx/issues). If you find any bugs in this documentation or in the program itself please report it [over on GitHub](https://github.com/anidl/multi-downloader-nx/issues).

View file

@ -67,7 +67,7 @@ export class Req {
} }
// debug // debug
if(this.debug){ if(this.debug){
console.debug('[DEBUG] FETCH OPTIONS:'); console.debug('[DEBUG] GOT OPTIONS:');
console.debug(options); console.debug(options);
} }
// try do request // try do request

View file

@ -57,6 +57,9 @@ const parseSelect = (selectString: string, but = false) : {
} else if (part.match(/[A-Z]{3}\.[0-9]*/)) { } else if (part.match(/[A-Z]{3}\.[0-9]*/)) {
select.push(part); select.push(part);
return; return;
} else if (part.match(/E?\d+\s\(NC\)/)) {
select.push(part);
return;
} }
const match = part.match(/[A-Za-z]+/); const match = part.match(/[A-Za-z]+/);
if (match && match.length > 0) { if (match && match.length > 0) {
@ -87,6 +90,9 @@ const parseSelect = (selectString: string, but = false) : {
if (st.match(/[0-9A-Z]{9}/)) { if (st.match(/[0-9A-Z]{9}/)) {
const included = select.includes(st); const included = select.includes(st);
return but ? !included : included; return but ? !included : included;
} else if (st.match(/E?\d+\s\(NC\)/)) {
const included = select.includes(st);
return but ? !included : included;
} else if (match && match.length > 0) { } else if (match && match.length > 0) {
if (match.index && match.index !== 0) { if (match.index && match.index !== 0) {
return false; return false;

View file

@ -1,7 +1,7 @@
{ {
"name": "multi-downloader-nx", "name": "multi-downloader-nx",
"short_name": "aniDL", "short_name": "aniDL",
"version": "5.1.5", "version": "5.1.4",
"description": "Downloader for Crunchyroll, Hidive, AnimeOnegai, and AnimationDigitalNetwork with CLI and GUI", "description": "Downloader for Crunchyroll, Hidive, AnimeOnegai, and AnimationDigitalNetwork with CLI and GUI",
"keywords": [ "keywords": [
"download", "download",