Anime1.me 下載器

下載Anime1.me網站上的動漫

2017/12/03時点のページです。最新版はこちら。

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
// ==UserScript==
// @name         Anime1.me 下載器
// @namespace    https://blog.maple3142.net/
// @version      0.1
// @description  下載Anime1.me網站上的動漫
// @author       maple3142
// @match        https://anime1.me/category/*
// @match        https://p.anime1.me/*
// @require      https://code.jquery.com/jquery-3.2.1.min.js
// @noframes
// @grant        none
// ==/UserScript==

(function($) {
    'use strict';
    function download(url,filename){
        const a=document.createElement('a');
        a.href=url;
        a.download=filename;
        document.body.appendChild(a);
        a.click();
        a.remove();
    }
    const loc=window.location;
    if(loc.hostname==='p.anime1.me'){
		//get datas
        const video=jwplayer().getPlaylist()[0];
        if(!video)return;
        const sources=video.sources;
        const title=video.title;
        const videomap={};
        for(const src of sources){
			videomap[src.label]=src.file
        }

		//ask user which to download
		const askmsg=`輸入要下載的畫質名稱:(${sources.map(src=>src.label).join(',')})`
		const type=prompt(askmsg)
		//if type exists
		if(type in videomap){
			download(videomap[type],`${title}.mp4`)
		}
    }
    else{
		const $et=$('.entry-title')
		const urls=[...$('iframe')].map(f=>f.src)
		for(let i=0;i<urls.length;i++){
			$($et.get(i)).append(`<small><a target="_blank" href="${urls[i]}">下載</a></small>`)
		}
    }
    // Your code here...
})(jQuery.noConflict());