Skip to content

Commit 3e6539c

Browse files
authored
Bump 1.3.0
1 parent bd0c968 commit 3e6539c

File tree

11 files changed

+171
-51
lines changed

11 files changed

+171
-51
lines changed

Crunchyroll_Premium/blockevidon.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

Crunchyroll_Premium/content.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ function importBetaPlayer(ready = false) {
8181
if (query('.video-player') && lastWatchedPlayer)
8282
lastWatchedPlayer.parentNode.removeChild(lastWatchedPlayer);
8383

84+
var titleLink = query('.show-title-link')
85+
if (titleLink) titleLink.style.zIndex = "2";
86+
8487
console.log("[CR Beta] Removendo player da Crunchyroll...");
8588
remove('.video-player-placeholder', 'Video Placeholder');
8689
remove('.video-player', 'Video Player', true);
@@ -92,10 +95,10 @@ function importBetaPlayer(ready = false) {
9295
var external_lang = preservedState.localization.locale.toLowerCase()
9396
var ep_lang = preservedState.localization.locale.replace('-', '')
9497
var ep_id = preservedState.watch.id
95-
var ep = preservedState.content.byId[ep_id]
98+
var ep = preservedState.content.media.byId[ep_id]
9699
if (!ep) { window.location.reload(); return; }
97-
var series_slug = ep.episode_metadata.series_slug_title
98-
var external_id = ep.external_id.substr(4)
100+
var series_slug = ep.parentSlug
101+
var external_id = getExternalId(ep.id).substr(4)
99102
var old_url = `https://www.crunchyroll.com/${external_lang}/${series_slug}/episode-${external_id}`
100103
var up_next = document.querySelector('[data-t="next-episode"] > a')
101104
var playback = ep.playback
@@ -134,7 +137,7 @@ function addPlayer(element, playerInfo, beta = false) {
134137
playerInfo['up_next_cooldown'] = items.cooldown === undefined ? 5 : items.cooldown;
135138
playerInfo['up_next_enable'] = items.aseguir === undefined ? true : items.aseguir;
136139
playerInfo['force_mp4'] = items.forcemp4 === undefined ? false : items.forcemp4;
137-
playerInfo['version'] = '1.2.2';
140+
playerInfo['version'] = '1.3.0';
138141
playerInfo['noproxy'] = true;
139142
playerInfo['beta'] = beta;
140143
ifrm.contentWindow.postMessage(playerInfo, "*");
@@ -205,7 +208,11 @@ function fetch(url) {
205208
})
206209
}
207210

211+
function getExternalId(id) {
212+
return JSON.parse(localStorage.getItem('externalIds'))[id];
213+
}
214+
208215
var s = document.createElement('script');
209-
s.src = chrome.runtime.getURL('blockevidon.js');
216+
s.src = chrome.runtime.getURL('interceptor.js');
210217
s.onload = function () { this.remove(); };
211218
(document.head || document.documentElement).appendChild(s);

Crunchyroll_Premium/interceptor.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
window.evidon_dg = {}
2+
3+
Object.defineProperty(window.evidon_dg, "evidonCriticalDomains", {
4+
get: function () { return ['wvc-x-callback:']; },
5+
});
6+
Object.defineProperty(window.evidon_dg, "productNames", {
7+
get: function () { return {}; },
8+
});
9+
Object.defineProperty(window.evidon_dg, "loadedProducts", {
10+
get: function () { return []; },
11+
});
12+
Object.defineProperty(window.evidon_dg, "productIds", {
13+
get: function () { return []; },
14+
});
15+
16+
console.log("[CR XHR] Configurando interceptor...")
17+
var rawOpen = XMLHttpRequest.prototype.open;
18+
19+
XMLHttpRequest.prototype.open = function () {
20+
if (!this._hooked) {
21+
this._hooked = true;
22+
setupHook(this);
23+
}
24+
rawOpen.apply(this, arguments);
25+
}
26+
27+
function setupHook(xhr) {
28+
let toggle = false;
29+
function getter() {
30+
delete xhr.responseText;
31+
var ret = xhr.responseText;
32+
try {
33+
if (toggle = !toggle) handleIntercept(JSON.parse(ret));
34+
} catch (e) { }
35+
setup();
36+
return ret;
37+
}
38+
39+
function setup() {
40+
Object.defineProperty(xhr, 'responseText', {
41+
get: getter,
42+
configurable: true
43+
});
44+
}
45+
setup();
46+
}
47+
48+
const verbose = false;
49+
// Intercepta response das requests (network)
50+
function handleIntercept(jsonResponse) {
51+
if (verbose) console.log("[CR XHR]", jsonResponse);
52+
53+
// Salva IDs externos dos panels no localStorage
54+
if (jsonResponse.items) jsonResponse.items.forEach(item => {
55+
if (item.id && item.external_id) {
56+
console.log("[CR XHR] Panel found:", item);
57+
storeExternalId(item.id, item.external_id)
58+
}
59+
})
60+
}
61+
62+
function storeExternalId(id, external_id) {
63+
let externalIds = localStorage.getItem('externalIds');
64+
if (externalIds) externalIds = JSON.parse(externalIds)
65+
else externalIds = {};
66+
externalIds[id] = external_id;
67+
localStorage.setItem('externalIds', JSON.stringify(externalIds));
68+
}

Crunchyroll_Premium/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Crunchyroll iFrame Player",
3-
"version": "1.2.2",
3+
"version": "1.3.0",
44
"description": "Permite ver todos os vídeos do crunchyroll gratuitamente.",
55
"author": "itallolegal",
66
"icons": {
@@ -17,7 +17,7 @@
1717
"declarativeNetRequestFeedback"
1818
],
1919
"web_accessible_resources": [{
20-
"resources": ["blockevidon.js"],
20+
"resources": ["interceptor.js"],
2121
"matches": ["<all_urls>"]
2222
}],
2323
"host_permissions": [

Crunchyroll_Premium_Kiwi-Browser/blockevidon.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

Crunchyroll_Premium_Kiwi-Browser/content.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ function importBetaPlayer(ready = false) {
140140
if (query('.video-player') && lastWatchedPlayer)
141141
lastWatchedPlayer.parentNode.removeChild(lastWatchedPlayer);
142142

143+
var titleLink = query('.show-title-link')
144+
if (titleLink) titleLink.style.zIndex = "2";
145+
143146
console.log("[CR Beta] Removendo player da Crunchyroll...");
144147
remove('.video-player-placeholder', 'Video Placeholder');
145148
remove('.video-player', 'Video Player', true);
@@ -151,10 +154,10 @@ function importBetaPlayer(ready = false) {
151154
var external_lang = preservedState.localization.locale.toLowerCase()
152155
var ep_lang = preservedState.localization.locale.replace('-', '')
153156
var ep_id = preservedState.watch.id
154-
var ep = preservedState.content.byId[ep_id]
157+
var ep = preservedState.content.media.byId[ep_id]
155158
if (!ep) { window.location.reload(); return; }
156-
var series_slug = ep.episode_metadata.series_slug_title
157-
var external_id = ep.external_id.substr(4)
159+
var series_slug = ep.parentSlug
160+
var external_id = getExternalId(ep.id).substr(4)
158161
var old_url = `https://www.crunchyroll.com/${external_lang}/${series_slug}/episode-${external_id}`
159162
var up_next = document.querySelector('[data-t="next-episode"] > a')
160163
var playback = ep.playback
@@ -193,7 +196,7 @@ function addPlayer(element, playerInfo, beta = false) {
193196
playerInfo['up_next_cooldown'] = items.cooldown === undefined ? 5 : items.cooldown;
194197
playerInfo['up_next_enable'] = items.aseguir === undefined ? true : items.aseguir;
195198
playerInfo['force_mp4'] = items.forcemp4 === undefined ? false : items.forcemp4;
196-
playerInfo['version'] = '1.2.2';
199+
playerInfo['version'] = '1.3.0';
197200
playerInfo['noproxy'] = true;
198201
playerInfo['beta'] = beta;
199202
ifrm.contentWindow.postMessage(playerInfo, "*");
@@ -282,7 +285,11 @@ function fetch(url) {
282285
})
283286
}
284287

288+
function getExternalId(id) {
289+
return JSON.parse(localStorage.getItem('externalIds'))[id];
290+
}
291+
285292
var s = document.createElement('script');
286-
s.src = chrome.runtime.getURL('blockevidon.js');
293+
s.src = chrome.runtime.getURL('interceptor.js');
287294
s.onload = function () { this.remove(); };
288295
(document.head || document.documentElement).appendChild(s);
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
window.evidon_dg = {}
2+
3+
Object.defineProperty(window.evidon_dg, "evidonCriticalDomains", {
4+
get: function () { return ['wvc-x-callback:']; },
5+
});
6+
Object.defineProperty(window.evidon_dg, "productNames", {
7+
get: function () { return {}; },
8+
});
9+
Object.defineProperty(window.evidon_dg, "loadedProducts", {
10+
get: function () { return []; },
11+
});
12+
Object.defineProperty(window.evidon_dg, "productIds", {
13+
get: function () { return []; },
14+
});
15+
16+
console.log("[CR XHR] Configurando interceptor...")
17+
var rawOpen = XMLHttpRequest.prototype.open;
18+
19+
XMLHttpRequest.prototype.open = function () {
20+
if (!this._hooked) {
21+
this._hooked = true;
22+
setupHook(this);
23+
}
24+
rawOpen.apply(this, arguments);
25+
}
26+
27+
function setupHook(xhr) {
28+
let toggle = false;
29+
function getter() {
30+
delete xhr.responseText;
31+
var ret = xhr.responseText;
32+
try {
33+
if (toggle = !toggle) handleIntercept(JSON.parse(ret));
34+
} catch (e) { }
35+
setup();
36+
return ret;
37+
}
38+
39+
function setup() {
40+
Object.defineProperty(xhr, 'responseText', {
41+
get: getter,
42+
configurable: true
43+
});
44+
}
45+
setup();
46+
}
47+
48+
const verbose = false;
49+
// Intercepta response das requests (network)
50+
function handleIntercept(jsonResponse) {
51+
if (verbose) console.log("[CR XHR]", jsonResponse);
52+
53+
// Salva IDs externos dos panels no localStorage
54+
if (jsonResponse.items) jsonResponse.items.forEach(item => {
55+
if (item.id && item.external_id) {
56+
console.log("[CR XHR] Panel found:", item);
57+
storeExternalId(item.id, item.external_id)
58+
}
59+
})
60+
}
61+
62+
function storeExternalId(id, external_id) {
63+
let externalIds = localStorage.getItem('externalIds');
64+
if (externalIds) externalIds = JSON.parse(externalIds)
65+
else externalIds = {};
66+
externalIds[id] = external_id;
67+
localStorage.setItem('externalIds', JSON.stringify(externalIds));
68+
}

Crunchyroll_Premium_Kiwi-Browser/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Crunchyroll iFrame Player",
3-
"version": "1.2.2",
3+
"version": "1.3.0",
44
"description": "Permite ver todos os vídeos do crunchyroll gratuitamente.",
55
"author": "itallolegal",
66
"icons": {
@@ -17,7 +17,7 @@
1717
"declarativeNetRequestFeedback"
1818
],
1919
"web_accessible_resources": [{
20-
"resources": ["blockevidon.js"],
20+
"resources": ["interceptor.js"],
2121
"matches": ["<all_urls>"]
2222
}],
2323
"host_permissions": [

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Obrigado por utilizar. :)
1010
Você pode encontrar as últimas versões disponíveis abaixo:
1111

1212

13-
<a href="https://github.com/mateus7g/crp-iframe-player/releases/latest" target="_blank"><img align="right" alt="Desktop" src="https://img.shields.io/badge/desktop-v1.2.2-violet?style=for-the-badge&logo=windows"></a>
13+
<a href="https://github.com/mateus7g/crp-iframe-player/releases/latest" target="_blank"><img align="right" alt="Desktop" src="https://img.shields.io/badge/desktop-v1.3.0-violet?style=for-the-badge&logo=windows"></a>
1414

1515
#### Desktop (PC)
1616

1717
Atualmente a versão para Desktop está disponível [aqui](https://github.com/Mateus7G/crp-iframe-player/releases/latest).
1818
Para instalar veja o passo a passo [para pc](#%EF%B8%8F-como-instalar-desktop).
1919

20-
<a href="https://github.com/Mateus7G/crp-iframe-player/releases/latest" target="_blank"><img align="right" alt="Android" src="https://img.shields.io/badge/android-v1.2.2-violet?style=for-the-badge&logo=android"></a>
20+
<a href="https://github.com/Mateus7G/crp-iframe-player/releases/latest" target="_blank"><img align="right" alt="Android" src="https://img.shields.io/badge/android-v1.3.0-violet?style=for-the-badge&logo=android"></a>
2121

2222
#### Android (Kiwi)
2323

assets/js/player.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ window.addEventListener("message", async e => {
205205
playerInstance.addButton(...webvideocasterBtn);
206206
else
207207
playerInstance.addButton(...downloadBtn);
208-
if (!tampermonkey && version !== "1.2.2")
208+
if (!tampermonkey && version !== "1.3.0")
209209
playerInstance.addButton(...updateBtn);
210210

211211
// Definir URL e Tamanho na lista de download

0 commit comments

Comments
 (0)