Skip to content

Commit 5918e6c

Browse files
committed
[AniLINK] Add Rerun functionality
1 parent fe3117d commit 5918e6c

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

AniLINK/AniLINK_Episode-Link-Extractor.user.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name AniLINK - Episode Link Extractor
33
// @namespace https://greasyfork.org/en/users/781076-jery-js
4-
// @version 6.23.0
4+
// @version 6.24.0
55
// @description Stream or download your favorite anime series effortlessly with AniLINK! Unlock the power to play any anime series directly in your preferred video player or download entire seasons in a single click using popular download managers like IDM. AniLINK generates direct download links for all episodes, conveniently sorted by quality. Elevate your anime-watching experience now!
66
// @icon https://www.google.com/s2/favicons?domain=animepahe.ru
77
// @author Jery
@@ -839,8 +839,7 @@ const Websites = [
839839
extractEpisodes: async function* (status) {
840840
status.text = 'Fetching episode list...';
841841
const contentId = _$('div.rating[data-id]')?.dataset.id; if (!contentId) return;
842-
const encId = await this._enc(contentId);
843-
const epElms = await fetch(`/ajax/episodes/list?id=${contentId}&_=${encId}`, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(r => r.json().then(d => d.result)).then(t => (new DOMParser()).parseFromString(t, 'text/html')).then(doc => [...doc.querySelectorAll('ul.episodes[data-season] li a')]);
842+
const epElms = [...document.querySelectorAll('ul.episodes:not([style*="display: none"]) li a')];
844843
const filteredEps = await applyEpisodeRangeFilter(epElms); if (!filteredEps?.length) return;
845844
const srcCfg = await (async () => {
846845
const servers = await fetch(`/ajax/links/list?eid=${filteredEps[0].getAttribute('eid')}&_=${await this._enc(filteredEps[0].getAttribute('eid'))}`, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(r => r.json().then(d => d.result)).then(t => (new DOMParser()).parseFromString(t, 'text/html')).then(doc => [...doc.querySelectorAll('li.server span')].map(s => s.textContent.trim()));
@@ -1098,6 +1097,7 @@ async function extractEpisodes() {
10981097
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
10991098
11001099
#AniLINK_Overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.8); z-index: 1000; display: flex; align-items: center; justify-content: center; }
1100+
#AniLINK_RerunBtn { position: fixed; top: 10px; right: 10px; background: transparent; border: 0; font-size: 36px; color: red; } #AniLINK_RerunBtn:hover { cursor: pointer; color: darkred; background-color: rgba(255, 255, 255, 0.1); }
11011101
#AniLINK_LinksContainer { width: 80%; max-height: 85%; background-color: #222; color: #eee; padding: 20px; border-radius: 8px; overflow-y: auto; display: flex; flex-direction: column;}
11021102
.anlink-status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; } /* Header for status bar and stop button */
11031103
.anlink-status-bar { color: #eee; flex-grow: 1; margin-right: 10px; display: block; } /* Status bar takes space */
@@ -1152,6 +1152,17 @@ async function extractEpisodes() {
11521152
? overlayDiv.remove()
11531153
: overlayDiv.style.display = "none");
11541154

1155+
// Rerun button
1156+
const rerunBtn = document.createElement('button');
1157+
rerunBtn.id = 'AniLINK_RerunBtn';
1158+
rerunBtn.title = 'Reset and Rerun Extraction';
1159+
rerunBtn.innerHTML = '<i class="material-icons" style="color:inherit;">delete</i>';
1160+
rerunBtn.addEventListener('click', () => {
1161+
overlayDiv.remove();
1162+
extractEpisodes();
1163+
});
1164+
overlayDiv.appendChild(rerunBtn);
1165+
11551166
// Create a container for links
11561167
const linksContainer = document.createElement('div');
11571168
linksContainer.id = "AniLINK_LinksContainer";

0 commit comments

Comments
 (0)