吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1770|回复: 28
上一主题 下一主题
收起左侧

[其他原创] 使用书签脚本获取到小红书直播回放的M3U8地址

  [复制链接]
跳转到指定楼层
楼主
zwb83925462 发表于 2025-11-14 11:32 回帖奖励
此书签脚本支持获取小红书的直播回放信息,是json格式的,里面的video_url值就是回放视频的播放地址,书签脚本代码如下,请复制后添加到书签
小红书回放下载
[JavaScript] 纯文本查看 复制代码
javascript:(function(){var queryString=window.location.search;var params=new URLSearchParams(queryString);var shareSourceId=params.get('share_source_id');var hostId=params.get('host_id');if(!shareSourceId||!hostId){alert('❌ 缺少必要参数!\n\nshare_source_id: '+shareSourceId+'\nhost_id: '+hostId);return}var xhshref="https://www.xiaohongshu.com/api/sns/v1/live/dynamic/clip_detail_web?clip_id="+shareSourceId+"&host_id="+hostId;navigator.clipboard.writeText(xhshref).then(()=>{var result='✅ API URL已复制到剪贴板!\n\n';result+='📋 参数信息:\n';result+='🔗 API URL:\n'+xhshref;if(confirm(result+'\n\n是否打开此API?')){location.href=xhshref}}).catch(()=>{alert('❌ 无法自动复制,请手动复制:\n\n'+xhshref)});console.log('生成的API URL:',xhshref)})();

免费评分

参与人数 4吾爱币 +6 热心值 +4 收起 理由
pjbl + 1 + 1 我很赞同!
Willian + 1 + 1 谢谢@Thanks!
HZ120 + 1 + 1 我很赞同!
hrh123 + 3 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
 楼主| zwb83925462 发表于 2025-11-15 10:03 |楼主
yeungh 发表于 2025-11-15 08:14
大佬 请问下哔哩哔哩的能获取吗

哔哩哔哩的比较难办,因为Dash模式的API需要用ffmpeg合并过,而解析单文件的API最高清晰度只有720P,所以比较麻烦.现在这个是dash模式的书签脚本,下载下来的是两个文件,一个是音频,一个是视频,需要自行混流.
[JavaScript] 纯文本查看 复制代码
javascript:(function(){const SCRIPT_VERSION='2.0';if(!window.location.href.match(/https:\/\/www\.bilibili\.com\/video\/(BV|av)/)){alert('请在B站视频页面使用此书签');return}if(window.bilibiliDownloaderLoaded){alert('下载工具已加载,请勿重复点击');return}window.bilibiliDownloaderLoaded=true;function init(){const hasData=window.__playinfo__||window?.__INITIAL_STATE__?.videoData||document.querySelector('[data-player]');if(!document.querySelector("#app")||!hasData){setTimeout(init,500);return}['bvm','bam','bdvd','bdl-container'].forEach(id=>{const el=document.getElementById(id);if(el)el.remove()});createDownloadUI()}function createDownloadUI(){const container=document.createElement('div');container.id='bdl-container';container.style=`position:fixed;top:100px;right:10px;z-index:10000;background:rgba(255,255,255,0.95);border:1px solid#ccc;border-radius:8px;padding:10px;box-shadow:0 2px 10px rgba(0,0,0,0.1);font-family:system-ui,-apple-system,sans-serif;min-width:150px;`;const title=document.createElement('div');title.textContent='B站下载工具';title.style='font-weight: bold; margin-bottom: 8px; border-bottom: 1px solid #eee; padding-bottom: 5px;';container.appendChild(title);const videoInfo=getVideoInfo();if(!videoInfo){alert('无法获取视频信息');return}createDownloadButton(container,'下载视频',videoInfo.videoUrl,videoInfo.bvid+'.m4v');createDownloadButton(container,'下载音频',videoInfo.audioUrl,videoInfo.bvid+'.m4a');createDownloadButton(container,'一键下载',null,null,()=>{downloadBoth(videoInfo.videoUrl,videoInfo.audioUrl,videoInfo.bvid)});const closeBtn=document.createElement('button');closeBtn.textContent='×';closeBtn.style=`position:absolute;top:5px;right:5px;background:none;border:none;font-size:16px;cursor:pointer;padding:0;width:20px;height:20px;`;closeBtn.onclick=()=>container.remove();container.appendChild(closeBtn);document.body.appendChild(container);makeDraggable(container)}function getVideoInfo(){try{const pdata=window?.__playinfo__?.data;if(!pdata?.dash){throw new Error('无法获取视频数据');}const video=pdata.dash.video?.[0];const audio=pdata.dash.audio?.[0];if(!video?.base_url||!audio?.base_url){throw new Error('视频/音频URL无效');}const bvid=window?.__INITIAL_STATE__?.bvid||window?.__INITIAL_STATE__?.videoData?.bvid||'video';return{videoUrl:video.base_url,audioUrl:audio.base_url,bvid:bvid,quality:pdata.accept_description?.[0]||'默认'}}catch(error){console.error('获取视频信息失败:',error);return null}}function createDownloadButton(container,text,url,filename,onClick){const btn=document.createElement('button');btn.textContent=text;btn.style=`display:block;width:100%;margin:5px 0;padding:8px 12px;background:#00a1d6;color:white;border:none;border-radius:4px;cursor:pointer;font-size:12px;`;btn.onclick=onClick||(()=>downloadFile(url,filename));btn.onmouseover=()=>btn.style.background='#008db2';btn.onmouseout=()=>btn.style.background='#00a1d6';container.appendChild(btn)}function downloadBoth(videoUrl,audioUrl,bvid){downloadFile(videoUrl,bvid+'.m4v');setTimeout(()=>{downloadFile(audioUrl,bvid+'.m4a')},1000)}function downloadFile(url,filename){fetch(url,{method:'GET',headers:{'User-Agent':navigator.userAgent,'Referer':location.href}}).then(response=>{if(!response.ok)throw new Error(`HTTP ${response.status}`);return response.blob()}).then(blob=>{const downloadUrl=URL.createObjectURL(blob);const a=document.createElement('a');a.href=downloadUrl;a.download=filename;document.body.appendChild(a);a.click();document.body.removeChild(a);setTimeout(()=>URL.revokeObjectURL(downloadUrl),1000)}).catch(error=>{console.error('下载失败:',error);alert('下载失败: '+error.message)})}function makeDraggable(element){let pos1=0,pos2=0,pos3=0,pos4=0;element.onmousedown=dragMouseDown;function dragMouseDown(e){e=e||window.event;e.preventDefault();pos3=e.clientX;pos4=e.clientY;document.onmouseup=closeDragElement;document.onmousemove=elementDrag}function elementDrag(e){e=e||window.event;e.preventDefault();pos1=pos3-e.clientX;pos2=pos4-e.clientY;pos3=e.clientX;pos4=e.clientY;element.style.top=(element.offsetTop-pos2)+"px";element.style.left=(element.offsetLeft-pos1)+"px"}function closeDragElement(){document.onmouseup=null;document.onmousemove=null}}const timeout=setTimeout(()=>{alert('加载超时,请刷新页面后重试')},8000);function safeInit(){clearTimeout(timeout);try{init()}catch(error){console.error('初始化失败:',error);alert('工具初始化失败: '+error.message)}}if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',safeInit)}else{safeInit()}})();
沙发
lupaf 发表于 2025-11-14 13:09
3#
kxky 发表于 2025-11-14 14:15
4#
guoerluosi 发表于 2025-11-14 14:18
感谢分享,非常实用了可以说
5#
天天哈皮 发表于 2025-11-14 14:49
请问要怎么使用?
6#
lbdcyy 发表于 2025-11-14 15:00
靠谱,看好不好用
7#
nimitz2025 发表于 2025-11-14 15:11
纯粹支持!
小红书不怎么看,也能下载视频,但就是支持这样的小工具!
8#
RexMax1974 发表于 2025-11-14 15:48
试试看好不好用
9#
YangGruai 发表于 2025-11-14 16:42
感谢分享,拿走试一试
10#
tonywenzi 发表于 2025-11-15 07:08
没理解,这东西怎么抓取的
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-4-17 04:02

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表