Skip to content

Instantly share code, notes, and snippets.

@tiancheng91
Last active April 30, 2025 10:43
Show Gist options
  • Select an option

  • Save tiancheng91/f6180a9d816e4b66697db7475504677b to your computer and use it in GitHub Desktop.

Select an option

Save tiancheng91/f6180a9d816e4b66697db7475504677b to your computer and use it in GitHub Desktop.
动漫新番 open ani strm 生成

使用方式

chmod +x generate_strms.sh
./generate_strms.sh https://ani.v300.eu.org/2025-4/ 202504
#!/bin/bash
# 参数校验
if [ $# -lt 2 ]; then
echo "用法: $0 <路径部分> <输出目录>"
echo "示例: $0 '2025-4/' './strm_output'"
exit 1
fi
API_BASE_URL="https://ani.v300.eu.org"
PATH_PART="$1"
OUTPUT_DIR="$2"
# 通用请求函数(支持递归目录)
fetch_and_generate_strm() {
local relative_path="$1"
local out_dir="$2"
local full_url="${API_BASE_URL}/${relative_path}"
echo "请求: $full_url"
# 发起请求
response=$(curl -s "$full_url" \
-H 'accept: */*' \
-H 'accept-language: zh-CN,zh;q=0.9' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
-b '_ga=GA1.1.1031387256.1745985378; _ga_27M1C0HVFG=GS1.1.1745999145.2.1.1745999190.0.0.0' \
-H 'dnt: 1' \
-H 'origin: https://ani.v300.eu.org' \
-H "referer: $full_url" \
-H 'sec-fetch-mode: cors' \
-H 'x-requested-with: XMLHttpRequest' \
--data-raw '{"password":"null"}')
if [[ -z "$response" ]]; then
echo "⚠️ 请求失败: $full_url"
return
fi
# 遍历每个文件/目录项
echo "$response" | jq -c '.files[]' | while read -r item; do
name=$(echo "$item" | jq -r '.name')
mime=$(echo "$item" | jq -r '.mimeType')
if [[ "$mime" == *folder* ]]; then
# 子目录递归
fetch_and_generate_strm "${relative_path}${name}/" "$out_dir"
elif [[ "$name" == *.mp4 ]]; then
strm_path="$out_dir/${name}.strm"
video_url="${API_BASE_URL}/${relative_path}${name}"
if [[ -f "$strm_path" ]]; then
echo "⏩ 已存在,跳过: $strm_path"
else
echo "$video_url" > "$strm_path"
echo "✅ 已生成: $strm_path"
fi
fi
done
}
# 创建输出目录
mkdir -p "$OUTPUT_DIR"
# 执行入口
fetch_and_generate_strm "$PATH_PART" "$OUTPUT_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment