Last active
March 16, 2025 15:16
-
-
Save knowlet/563d73bee7b5e0a06f3fb1c1b85b0b2f to your computer and use it in GitHub Desktop.
啪啪啪研習所無限看2.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 啪啪啪研習所無限看2.1 | |
// @namespace https://knowlet.me/ | |
// @version 0.2 | |
// @description 繞過前端付費會員驗證 | |
// @author knowlet | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js | |
// @match https://jav101.com/play/* | |
// ==/UserScript== | |
/* jshint ignore:start */ | |
var inline_src = (<><![CDATA[ | |
/* jshint ignore:end */ | |
/* jshint esnext: false */ | |
/* jshint esversion: 6 */ | |
(async function(avId) { | |
async function findLastIdx(no, pn, testRange) { | |
console.log(`pn: ${pn}, no: ${no}, testRange: ${testRange}`); | |
try { | |
await fetch(`https://sss.jav101.com/static/${avId}/ts/${avId}-${no}.ts`) | |
.then(url => { | |
testRange = Math.floor((pn - no) / 2); | |
no += testRange; | |
}) | |
} catch (err) { | |
pn = no; | |
no -= testRange; | |
} | |
if (testRange) return findLastIdx(no, pn, testRange); | |
return no; | |
} | |
let dot = 3; | |
const html = document.querySelector('h2.videoTitle').innerHTML; | |
const dotting = setInterval(_ => { document.querySelector('h2.videoTitle').innerHTML = html + `<span style="color: #F5515F">破解中請稍後${new Array(++dot % 10).join('.')}</span>`; }, 789); | |
const num = localStorage.getItem(avId) || await findLastIdx(900, 1500, 100); | |
localStorage.setItem(avId, num); | |
let m3u8 = '#EXTM3U\n#EXT-X-VERSION:3\n#EXT-X-PLAYLIST-TYPE:VOD\n#EXT-X-INDEPENDENT-SEGMENTS\n#EXT-X-TARGETDURATION:8\n#EXT-X-MEDIA-SEQUENCE:0'; | |
for (let i = 0; i <= num; ++i) { | |
m3u8 += `\n#EXTINF:8.341667,\nhttps://sss.jav101.com/static/${avId}/ts/${avId}-${i}.ts`; | |
} | |
m3u8 += '\n#EXT-X-ENDLIST'; | |
videojs('videoJav').dispose(); | |
clearInterval(dotting); | |
document.querySelector('h2.videoTitle').innerHTML = html + '<span style="color: #F5515F">破解完成!</span>'; | |
const createObjectURL = (window.URL && URL.createObjectURL.bind(URL)) || (window.webkitURL && webkitURL.createObjectURL.bind(webkitURL)) || window.createObjectURL; | |
const blobURL = createObjectURL(new Blob([m3u8], {type: 'application/x-mpegURL'})); | |
document.querySelector('.vcontainer').innerHTML = `<video id="videoJav" class="video-js vjs-default-skin" controls> | |
<source src="${blobURL}" type='application/x-mpegURL'/> | |
</video>`; | |
var player = videojs('videoJav', { | |
"autoplay": false, | |
"muted": false, | |
"width": 790, | |
"height": 444 | |
}, function() { | |
this.hotkeys({ | |
volumeStep: 0.1, | |
seekStep: 5, | |
enableModifiersForNumbers: false, | |
enableVolumeScroll:false | |
}); | |
}); | |
})(location.pathname.split('/').pop()); | |
/* jshint ignore:start */ | |
]]></>).toString(); | |
var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] }); | |
eval(c.code); | |
/* jshint ignore:end */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment