Last active
April 28, 2025 00:13
-
-
Save BoYanZh/9eb1ee4c9a861fd2143cb5ce34091774 to your computer and use it in GitHub Desktop.
Apex-Crispy-Duck-Bot
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
| { | |
| "🐮高能混剪": [ | |
| { | |
| "BoYanZh": "成功转身\nhttps://outplayed.tv/apex-legends/wklY26" | |
| }, | |
| { | |
| "Hollins": "应激\nhttps://outplayed.tv/apex-legends/V6Pd8X" | |
| }, | |
| { | |
| "Hollins": "这个一梭子150感觉也没办法了\nhttps://outplayed.tv/apex-legends/2PDZWz" | |
| }, | |
| { | |
| "Hollins": "来自彩虹六号的P92高手\nhttps://outplayed.tv/apex-legends/P6xEJy" | |
| }, | |
| { | |
| "tztgracious": "纯在身位啊 <@246786648191401994> \nhttps://outplayed.tv/apex-legends/QyE2eW" | |
| }, | |
| { | |
| "Hollins": "萨姆斯博士还是有点东西\nhttps://outplayed.tv/apex-legends/wkYZj5" | |
| }, | |
| { | |
| "BoYanZh": "帽子像希尔的假装幻象的暴雷\nhttps://outplayed.tv/apex-legends/N6BdGO" | |
| }, | |
| { | |
| "BoYanZh": "神秘algs标恶灵\nhttps://outplayed.tv/apex-legends/bB231Y" | |
| }, | |
| { | |
| "BoYanZh": "你说1打1我就不困了\nhttps://outplayed.tv/apex-legends/MJkjLx" | |
| }, | |
| { | |
| "BoYanZh": "矿洞随机刷怪了\nhttps://outplayed.tv/apex-legends/YO437W" | |
| }, | |
| { | |
| "BoYanZh": "随机刷新支线任务\nhttps://outplayed.tv/apex-legends/BXxeBx" | |
| }, | |
| { | |
| "BoYanZh": "800米大转移抢空投还遇同行\n塔+板+板+飞+板\nhttps://outplayed.tv/apex-legends/x8k6zB" | |
| }, | |
| { | |
| "BoYanZh": "都别活\nhttps://outplayed.tv/apex-legends/KdMoPj" | |
| }, | |
| { | |
| "BoYanZh": "734-487=247\nhttps://outplayed.tv/apex-legends/V6Ya8X" | |
| }, | |
| { | |
| "BoYanZh": "200\nhttps://outplayed.tv/apex-legends/P6oa2M" | |
| }, | |
| { | |
| "BoYanZh": "幻象开大以为自己在6打2 闹麻了\nhttps://outplayed.tv/apex-legends/XgE3GP" | |
| }, | |
| { | |
| "BoYanZh": "队友帮我吸子弹\nhttps://outplayed.tv/apex-legends/820d6P" | |
| }, | |
| { | |
| "BoYanZh": "虽然不知道为什么觉得栓到了,但看这ash好像刀过去了,我也先过去秒一个吧\nhttps://outplayed.tv/apex-legends/grJnk5" | |
| }, | |
| { | |
| "RM": "没血条的神秘人\nhttps://outplayed.tv/apex-legends/ZOWDK3" | |
| }, | |
| { | |
| "RM": "扣小电的神秘人\nhttps://outplayed.tv/apex-legends/BXxeLE" | |
| }, | |
| { | |
| "RM": "像队友的神秘人\nhttps://outplayed.tv/apex-legends/grJndW" | |
| }, | |
| { | |
| "BoYanZh": "来就200\nhttps://outplayed.tv/apex-legends/lrXNxO" | |
| }, | |
| { | |
| "BoYanZh": "一直没看到命脉\nhttps://outplayed.tv/apex-legends/z8Q4e3" | |
| }, | |
| { | |
| "BoYanZh": "来就240\nhttps://outplayed.tv/apex-legends/4egEvJ" | |
| }, | |
| { | |
| "Hollins": "jump scare\nhttps://outplayed.tv/apex-legends/JPO4Q4" | |
| }, | |
| { | |
| "Hollins": "888落地架\nhttps://outplayed.tv/apex-legends/lrXn1Y" | |
| }, | |
| { | |
| "Hollins": "丝血反杀\nhttps://outplayed.tv/apex-legends/bB2lGZ" | |
| }, | |
| { | |
| "Hollins": "一颗雷炸死两个\nhttps://outplayed.tv/apex-legends/BXxJ7Z" | |
| }, | |
| { | |
| "BoYanZh": "不知道人爬哪去了\nhttps://outplayed.tv/apex-legends/O6Q75X" | |
| }, | |
| { | |
| "BoYanZh": "神力对碰\nhttps://outplayed.tv/apex-legends/N6ByGw" | |
| }, | |
| { | |
| "M4tcha": "纯血1v3\nhttps://outplayed.tv/apex-legends/jylXka" | |
| }, | |
| { | |
| "M4tcha": "偷吃电弧星\nhttps://outplayed.tv/apex-legends/MJk2kx" | |
| }, | |
| { | |
| "BoYanZh": "雷\nhttps://outplayed.tv/apex-legends/x8kZgz" | |
| }, | |
| { | |
| "BoYanZh": "找到个旧的 身法地平线 闹麻了\nhttps://outplayed.tv/apex-legends/4eg8Lz" | |
| }, | |
| { | |
| "RM": "1v3\nhttps://outplayed.tv/apex-legends/k7mZ12" | |
| }, | |
| { | |
| "zhli": "战斗爽三分钟\nhttps://outplayed.tv/apex-legends/m3x5Rz" | |
| }, | |
| { | |
| "zhli": "狙狙的喷\nhttps://outplayed.tv/apex-legends/YO4BZ3" | |
| }, | |
| { | |
| "M4tcha": "变换:小众变态游戏怎么没脚步啊\nhttps://outplayed.tv/apex-legends/z8QBJr" | |
| } | |
| ], | |
| "🤬红温复盘": [ | |
| { | |
| "Hollins": "就那个进圈\nhttps://outplayed.tv/apex-legends/Kdl2gG" | |
| }, | |
| { | |
| "Hollins": "没啥 只是2k伤害没有头\nhttps://outplayed.tv/apex-legends/G4n80X" | |
| }, | |
| { | |
| "BoYanZh": "纯被冷暴力\nhttps://outplayed.tv/apex-legends/XgEz5D" | |
| }, | |
| { | |
| "M4tcha": "Check out my video! #ApexLegends | Captured by #Outplayed\nhttps://outplayed.tv/apex-legends/3d5Wny" | |
| } | |
| ], | |
| "🐴下饭操作": [ | |
| { | |
| "Hollins": "给不起最简单的承诺~\nhttps://outplayed.tv/apex-legends/0KG8QO" | |
| }, | |
| { | |
| "Hollins": "被猎杀哥一脚踢死\nhttps://outplayed.tv/apex-legends/z8xgVE" | |
| }, | |
| { | |
| "RM": "背包杀\nhttps://outplayed.tv/apex-legends/JPRGY3" | |
| }, | |
| { | |
| "zhli": "被猎杀玩弄记录\nhttps://outplayed.tv/apex-legends/jylnYa" | |
| }, | |
| { | |
| "BoYanZh": "是吗?是啊。是吗?是,是。啊,不对啊?不是啊。是的呀。是的呀,这能看错?\nhttps://outplayed.tv/apex-legends/DxKYYy" | |
| }, | |
| { | |
| "BoYanZh": "高抛炸100\nhttps://outplayed.tv/apex-legends/4egeVP" | |
| }, | |
| { | |
| "BoYanZh": "为什么ktt在喊 宝宝\nhttps://outplayed.tv/apex-legends/KdM7NG" | |
| } | |
| ] | |
| } |
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
| import hashlib | |
| import subprocess | |
| import json | |
| import re | |
| from urllib.parse import urlparse | |
| import requests | |
| def extract_url_with_prefix(text, prefix): | |
| escaped_prefix = re.escape(prefix) | |
| pattern = escaped_prefix + r'[^\s\'"()<>\[\]{}|\\^`]*' | |
| match = re.search(pattern, text) | |
| if match: | |
| return match.group(0) | |
| else: | |
| return "" | |
| def extract_video_url(url): | |
| try: | |
| # Get HTML content | |
| response = requests.get(url) | |
| response.raise_for_status() | |
| html_content = response.text | |
| video_src_pattern = re.search( | |
| r'<video[^>]*src=[\'"]([^\'"]+)[\'"]', html_content | |
| ) | |
| if not video_src_pattern: | |
| print("No video tag or src attribute found") | |
| return None | |
| video_url = video_src_pattern.group(1) | |
| if video_url.startswith("/"): | |
| base_url = "{0.scheme}://{0.netloc}".format(urlparse(url)) | |
| video_url = base_url + video_url | |
| return video_url | |
| except Exception as e: | |
| print(f"Error during URL extraction: {e}") | |
| return None | |
| def download_video(video_url, output_path="downloaded_video.mp4"): | |
| try: | |
| # Download video | |
| print(f"Downloading video from: {video_url}") | |
| video_response = requests.get(video_url, stream=True) | |
| video_response.raise_for_status() | |
| # Save video | |
| with open(output_path, "wb") as f: | |
| for chunk in video_response.iter_content(chunk_size=8192): | |
| if chunk: | |
| f.write(chunk) | |
| print(f"Video successfully downloaded to: {output_path}") | |
| return True | |
| except Exception as e: | |
| print(f"Error during download: {e}") | |
| return False | |
| if __name__ == "__main__": | |
| video_files = [] | |
| texts = [] | |
| fns = [] | |
| data = json.load(open("res.json", "r")) | |
| for channel in ["🐮高能混剪", "🤬红温复盘", "🐴下饭操作"]: | |
| for item in data[channel]: | |
| for user, message in item.items(): | |
| page_url = extract_url_with_prefix( | |
| message, "https://outplayed.tv/apex-legends/" | |
| ) | |
| if not page_url: | |
| continue | |
| video_url = extract_video_url(page_url) | |
| if not video_url: | |
| continue | |
| print(user, message, video_url) | |
| fn = hashlib.md5(video_url.encode()).hexdigest() + ".mp4" | |
| download_video(video_url, "./tmp/" + fn) | |
| video_files.append("./tmp/" + fn) | |
| texts.append("@" + user) | |
| fns.append(fn) | |
| for i, (video_file, text, fn) in enumerate(zip(video_files, texts, fns)): | |
| print(i, video_file, text, fn) | |
| args = [ | |
| "ffmpeg", | |
| # "-hwaccel", | |
| # "cuda", | |
| "-i", | |
| "./tmp/" + fn, | |
| "-y", | |
| "-vf", | |
| f"drawtext=text='{text}':fontcolor=white:fontsize=64:borderw=4:bordercolor=black:x=20:y=20", | |
| "-af", | |
| "loudnorm=I=-16:TP=-1.5:LRA=11", | |
| "-c:v", | |
| "h264_nvenc", | |
| "-preset", | |
| "fast", | |
| "-rc", | |
| "vbr", | |
| "-cq", | |
| "23", | |
| "-b:v", | |
| "0", | |
| "-r", | |
| "30", | |
| "-s", | |
| "1920x1080", | |
| "-ar", | |
| "48000", | |
| "-ac", | |
| "2", | |
| "./output/" + fn, | |
| ] | |
| subprocess.run(args) | |
| content = "\n".join(f"file ./output/{fn}" for fn in fns) | |
| with open("list.txt", "w") as f: | |
| f.write(content) | |
| args = [ | |
| "ffmpeg", | |
| "-hwaccel", | |
| "cuda", | |
| "-y", | |
| "-f", | |
| "concat", | |
| "-safe", | |
| "0", | |
| "-i", | |
| "list.txt", | |
| "-c:v", | |
| "hevc_nvenc", | |
| "-preset", | |
| "p4", | |
| "-cq", | |
| "28", | |
| "-c:a", | |
| "aac", | |
| "-b:a", | |
| "128k", | |
| "merged.mp4", | |
| ] | |
| subprocess.run(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment