海角社区

目前可以用,可以查看金币钻石视频

< Feedback on 海角社区

Review: Good - script works

§
Posted: 18.5.2024

接口脚本 欢迎使用
// ==UserScript==
// @name 大兄弟
// @namespace http://tampermonkey.net/
// @version 1.0
// @description 在移动设备上获取数据并添加视频播放器
// @author 大兄弟
// @match https://*/post/details?pid=*
// @grant GM_setClipboard
// ==/UserScript==

(function() {
'use strict';

var videoContainer = document.createElement('div');
var closeButton = document.createElement('div');
var video;

function isMobileDevice() {
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}

function getPidFromUrl() {
var url = window.location.href;
var regex = /[?&]pid=(\d+)/;
var matches = regex.exec(url);
if (matches && matches.length > 1) {
return matches[1];
}
return null;
}

async function sendApiRequestAndPlay(pid) {
var apiUrl = 'http://www.djyun.icu/api/hjjx?id=' + pid;
try {
var response = await fetch(apiUrl);
var data = await response.text();
var m3u8Url = getM3U8UrlFromData(data);
if (m3u8Url) {
GM_setClipboard(m3u8Url);
showNotification('数据已复制');
playVideo(m3u8Url);
} else {
console.error('无法获取m3u8链接');
showNotification('无法获取m3u8链接,请重试!');
}
} catch (error) {
console.error('请求失败:', error);
showNotification('请求失败,请重试!');
}
}

function showNotification(message) {
var notification = document.createElement('div');
notification.style.position = 'fixed';
notification.style.bottom = '40px';
notification.style.right = '20px';
notification.style.width = '240px';
notification.style.padding = '16px';
notification.style.background = 'rgba(0, 0, 0, 0.8)';
notification.style.color = 'white';
notification.style.borderRadius = '8px';
notification.style.textAlign = 'center';
notification.style.lineHeight = '20px';
notification.style.fontFamily = 'Arial, sans-serif';
notification.style.fontSize = '14px';
notification.style.boxShadow = '0px 2px 4px rgba(0, 0, 0, 0.3)';
notification.innerText = message;
document.body.appendChild(notification);

setTimeout(function() {
notification.style.opacity = '0';
setTimeout(function() {
notification.remove();
}, 500);
}, 3000);
}

function playVideo(m3u8Url) {
video = document.createElement('video');
video.src = m3u8Url;
video.controls = true;
video.style.width = '100%';
video.style.height = '100%';
videoContainer.appendChild(video);
videoContainer.style.position = 'fixed';
videoContainer.style.top = '0';
videoContainer.style.left = '0';
videoContainer.style.width = '100%';
videoContainer.style.height = '100%';
videoContainer.style.background = 'rgba(0, 0, 0, 0.8)';
videoContainer.style.zIndex = '9999';
document.body.appendChild(videoContainer);

closeButton.style.position = 'fixed';
closeButton.style.top = '20px';
closeButton.style.right = '20px';
closeButton.style.width = '30px';
closeButton.style.height = '30px';
closeButton.style.background = '#FF6161';
closeButton.style.borderRadius = '50%';
closeButton.style.textAlign = 'center';
closeButton.style.lineHeight = '30px';
closeButton.style.cursor = 'pointer';
closeButton.style.fontFamily = 'Arial, sans-serif';
closeButton.style.fontSize = '16px';
closeButton.style.fontWeight = 'bold';
closeButton.style.boxShadow = '0px 2px 4px rgba(0, 0, 0, 0.3)';
closeButton.innerText = 'X';
closeButton.addEventListener('click', function() {
document.body.removeChild(videoContainer);
video = null;
});
videoContainer.appendChild(closeButton);
}

function stopVideo() {
if (video) {
document.body.removeChild(videoContainer);
video = null;
}
}

function addFloatingButton() {
var button = document.createElement('div');
button.style.position = 'fixed';
button.style.bottom = '50px';
button.style.right = '20px';
button.style.width = '60px';
button.style.height = '60px';
button.style.background = '#FF6161';
button.style.color = 'white';
button.style.borderRadius = '50%';
button.style.textAlign = 'center';
button.style.lineHeight = '60px';
button.style.cursor = 'pointer';
button.style.fontFamily = 'Arial, sans-serif';
button.style.fontSize = '16px';
button.style.fontWeight = 'bold';
button.style.boxShadow = '0px 2px 4px rgba(0, 0, 0, 0.3)';
button.innerText = '复制';
button.addEventListener('click', function() {
var pid = getPidFromUrl();
if (pid) {
stopVideo(); // 停止当前视频播放
sendApiRequestAndPlay(pid);
} else {
showNotification('无法获取pid');
}
});
document.body.appendChild(button);
}

function stopVideoOnUnload() {
if (video) {
stopVideo();
}
}

function getM3U8UrlFromData(data) {
var regex = /URL:(.+)/;
var matches = regex.exec(data);
if (matches && matches.length > 1) {
return matches[1];
}
return null;

}

if (isMobileDevice()) {
addFloatingButton();
window.addEventListener('beforeunload', stopVideoOnUnload);
}
})();

§
Posted: 19.5.2024

这个怎么用

§
Posted: 20.5.2024

我用过大兄弟,不能用,不知道这个是不是升级版

§
Posted: 20.5.2024

我用过大兄弟,不能用,不知道这个是不是升级版

正常接口状态是可以用的

Post reply

Sign in to post a reply.