manga-download / hakuneko

Manga & Anime Downloader for Linux, Windows & MacOS
https://hakuneko.download
The Unlicense
4.61k stars 460 forks source link

[Site Request] Twist.moe - Anime site #2268

Closed newaccforhc closed 1 year ago

newaccforhc commented 4 years ago

Name of the website Twist moe

Website urls (examples below)

Languages En

*Website relationship Nope.

Additional details Nope.

ronny1982 commented 4 years ago

Developer Notes

All Anime/Episode/Media is provided via JSON To make a request, the X-Access-Token header is required. The token is 1rj2vRtegS8Y60B3w3qNZm5T2Q0TN2NR (hardcoded in https://twist.moe/_nuxt/ff45a5096fee869a0df5.js) To decrypt the mp4 stream URL, a sourceKey is required. The key is LXgIVP&PorO68Rq7dTx8N^lP!Fa5sGJ^*XK (hardcoded in 'https://twist.moe/_nuxt/ff45a5096fee869a0df5.js)

List Animes:

(async function() {
    const response = await fetch('https://twist.moe/api/anime', {
        headers: {
            'X-Access-Token': '1rj2vRtegS8Y60B3w3qNZm5T2Q0TN2NR'
        }
    });
    const data = await response.json();
    console.log(data.map(anime => {
        return {
            id: anime.slug.slug,
            title: anime.title
        };
    }));
})();

List Episodes:

(async function() {
    const response = await fetch('https://twist.moe/api/anime/hack-sign', {
        headers: {
            'X-Access-Token': '1rj2vRtegS8Y60B3w3qNZm5T2Q0TN2NR'
        }
    });
    const data = await response.json();
    console.log(data.episodes.map(episode => {
        return {
            id: episode.id,
            title: ('Episode ' + episode.number).padStart(3, '0')
        };
    }));
})();

Get Stream:

const script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js';
document.body.appendChild(script);
(async function() {
    const response = await fetch('https://twist.moe/api/anime/hack-sign/sources', {
        headers: {
            'X-Access-Token': '1rj2vRtegS8Y60B3w3qNZm5T2Q0TN2NR'
        }
    });
    const data = await response.json();
    const encrypted = data.find(episode => episode.id === 53782).source;
    let decrypted = CryptoJS.AES.decrypt(encrypted, 'LXgIVP&PorO68Rq7dTx8N^lP!Fa5sGJ^*XK').toString(CryptoJS.enc.Utf8);
    if(!decrypted.startsWith('http')) {
        decrypted = 'https://twistcdn.bunny.sh' + decrypted;
    }
    // NOTE: to download stream use headers -H 'User-Agent: Mozilla/5.0' -H 'Referer: https://twist.moe'
    console.log(decrypted);
})();

The mp4 stream CDN is also hardcoded in https://twist.moe/_nuxt/ff45a5096fee869a0df5.js

                cdnDomain: function() {
                    var e = this.viewingAnime.episodes
                      , t = e[e.length - 1].number - this.viewingEpisode.number <= 10;
                    return this.viewingAnime.ongoing && (e.length <= 14 || t) ? "https://at-cdn.bunny.sh" : "https://twistcdn.bunny.sh"
                }
MikeZeDev commented 1 year ago

Dead website