diff --git a/.gitignore b/.gitignore index 80a024d..ee360c6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,18 +10,19 @@ dist .DS_Store # Electron -crunchyroll-downloader-advanced-output +crunchyroll-downloader-output debug.log debug.log *.log debug.json errors.json build/ -crunchyroll-downloader-advanced-output-*/ +crunchyroll-downloader-output-*/ +updater/ # FFMPEG ffmpeg/ # MP4DECRYPT mp4decrypt/ -keys/ +src/api/services/widevine.ts diff --git a/build.js b/build.js index 5cf756c..07976fb 100644 --- a/build.js +++ b/build.js @@ -6,8 +6,8 @@ const Platform = builder.Platform * @type {import('electron-builder').Configuration} */ const options = { - appId: 'com.stratum.crunchyrolldownloaderadvanced', - productName: 'Crunchyroll Downloader Advanced', + appId: 'com.stratum.crunchyrolldownloader', + productName: 'Crunchyroll Downloader', compression: 'maximum', removePackageScripts: true, @@ -15,12 +15,17 @@ const options = { nodeGypRebuild: true, buildDependenciesFromSource: true, + publish: { + provider: 'github', + releaseType: 'release' + }, + directories: { - output: 'crunchyroll-downloader-advanced-output-${version}' + output: 'crunchyroll-downloader-output-${version}' }, win: { - artifactName: 'crunchyroll-downloader-advanced-${version}-windows-installer.${ext}', + artifactName: 'crunchyroll-downloader-${version}-windows-installer.${ext}', icon: 'public/favicon.ico', target: [ { diff --git a/components/MainHeader.vue b/components/MainHeader.vue index 5126502..c2da53c 100644 --- a/components/MainHeader.vue +++ b/components/MainHeader.vue @@ -14,8 +14,7 @@
Crunchyroll
- Downloader
- Advanced
diff --git a/components/Updater.vue b/components/Updater.vue new file mode 100644 index 0000000..8d7799e --- /dev/null +++ b/components/Updater.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/package.json b/package.json index b5fc975..129c0f8 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { - "name": "crunchyroll-downloader-advanced", + "name": "crunchyroll-downloader", "author": "Stratum", - "description": "Crunchyroll Downloader Advanced", - "version": "1.0.0", + "description": "Crunchyroll Downloader", + "version": "1.1.0", "private": true, "main": ".output/src/electron/background.js", + "repository": "https://github.com/stratuma/Crunchyroll-Downloader-v4.0", "scripts": { "dev": "nuxt dev -o", "build": "nuxt generate", @@ -53,11 +54,9 @@ "fastify": "^4.26.2", "fluent-ffmpeg": "^2.1.2", "jsencrypt": "^3.3.2", - "long": "^5.2.3", "mpd-parser": "^1.3.0", "node-cache": "^5.1.2", "node-cron": "^3.0.3", - "protobufjs": "^7.2.6", "sequelize": "^6.37.3", "sqlite3": "5.1.6" }, @@ -65,7 +64,7 @@ "extraResources": [ "./ffmpeg/**", "./mp4decrypt/**", - "./keys/**" + "./updater/**" ] } } diff --git a/src/api/routes/crunchyroll/crunchyroll.service.ts b/src/api/routes/crunchyroll/crunchyroll.service.ts index 5695a8d..9c47ccd 100644 --- a/src/api/routes/crunchyroll/crunchyroll.service.ts +++ b/src/api/routes/crunchyroll/crunchyroll.service.ts @@ -6,6 +6,9 @@ import { parse as mpdParse } from 'mpd-parser' import { loggedInCheck } from '../service/service.service' import { app } from 'electron' +// Disable when Crunchyroll turns off switch endpoint +const enableDRMBypass = false + const crErrors = [ { error: 'invalid_grant', @@ -118,46 +121,15 @@ export async function crunchyGetPlaylist(q: string) { } try { - const response = await fetch(`https://cr-play-service.prd.crunchyrollsvc.com/v1/${q}/console/switch/play`, { - method: 'GET', - headers: headers - }) - - if (response.ok) { - const data: VideoPlaylist = JSON.parse(await response.text()) - - data.hardSubs = Object.values((data as any).hardSubs) - - data.subtitles = Object.values((data as any).subtitles) - - return { data: data, account_id: login.account_id } - } else { - throw new Error(await response.text()) - } - } catch (e) { - throw new Error(e as string) - } -} - -export async function crunchyGetPlaylistDRM(q: string) { - const account = await loggedInCheck('CR') - - if (!account) return - - const { data: login, error } = await crunchyLogin(account.username, account.password) - - if (!login) return - - const headers = { - Authorization: `Bearer ${login.access_token}`, - 'x-cr-stream-limits': 'false' - } - - try { - const response = await fetch(`https://cr-play-service.prd.crunchyrollsvc.com/v1/${q}/tv/samsung/play`, { - method: 'GET', - headers: headers - }) + const response = await fetch( + enableDRMBypass + ? `https://cr-play-service.prd.crunchyrollsvc.com/v1/${q}/tv/samsung/play` + : `https://cr-play-service.prd.crunchyrollsvc.com/v1/${q}/console/switch/play`, + { + method: 'GET', + headers: headers + } + ) if (response.ok) { const data: VideoPlaylist = JSON.parse(await response.text()) diff --git a/src/api/routes/service/service.service.ts b/src/api/routes/service/service.service.ts index df22062..ad6f368 100644 --- a/src/api/routes/service/service.service.ts +++ b/src/api/routes/service/service.service.ts @@ -4,7 +4,7 @@ import { concatenateTSFiles } from '../../services/concatenate' import { createFolder, createFolderName, deleteFolder, deleteTemporaryFolders } from '../../services/folder' import { downloadADNSub, downloadCRSub } from '../../services/subs' import { CrunchyEpisode } from '../../types/crunchyroll' -import { crunchyGetPlaylist, crunchyGetPlaylistDRM, crunchyGetPlaylistMPD, deleteVideoToken } from '../crunchyroll/crunchyroll.service' +import { crunchyGetPlaylist, crunchyGetPlaylistMPD, deleteVideoToken } from '../crunchyroll/crunchyroll.service' import fs from 'fs' var cron = require('node-cron') import { Readable } from 'stream' @@ -327,7 +327,7 @@ export async function downloadCrunchyrollPlaylist( await updatePlaylistByID(downloadID, 'downloading') - var playlist = await crunchyGetPlaylistDRM(e) + var playlist = await crunchyGetPlaylist(e) if (!playlist) { await updatePlaylistByID(downloadID, 'failed') @@ -340,7 +340,7 @@ export async function downloadCrunchyrollPlaylist( const found = playlist.data.versions.find((v) => v.audio_locale === 'ja-JP') if (found) { await deleteVideoToken(episodeID, playlist.data.token) - playlist = await crunchyGetPlaylistDRM(found.guid) + playlist = await crunchyGetPlaylist(found.guid) } else { console.log('Exact Playlist not found, taking what crunchy gives.'), messageBox( @@ -394,7 +394,7 @@ export async function downloadCrunchyrollPlaylist( if (playlist.data.audioLocale !== 'ja-JP') { const foundStream = playlist.data.versions.find((v) => v.audio_locale === 'ja-JP') if (foundStream) { - subPlaylist = await crunchyGetPlaylistDRM(foundStream.guid) + subPlaylist = await crunchyGetPlaylist(foundStream.guid) } } else { subPlaylist = playlist @@ -424,7 +424,7 @@ export async function downloadCrunchyrollPlaylist( } if (found) { - const list = await crunchyGetPlaylistDRM(found.guid) + const list = await crunchyGetPlaylist(found.guid) if (list) { const foundSub = list.data.subtitles.find((sub) => sub.language === d) if (foundSub) { @@ -479,7 +479,7 @@ export async function downloadCrunchyrollPlaylist( const audioDownload = async () => { const audios: Array = [] for (const v of dubDownloadList) { - const list = await crunchyGetPlaylistDRM(v.guid) + const list = await crunchyGetPlaylist(v.guid) if (!list) return @@ -554,7 +554,7 @@ export async function downloadCrunchyrollPlaylist( return } - const play = await crunchyGetPlaylistDRM(code) + const play = await crunchyGetPlaylist(code) if (!play) { await updatePlaylistByID(downloadID, 'failed')