add support for [service name] #343

Closed
opened 2025-11-09 09:46:50 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @wanquanY on GitHub (Jul 9, 2024).

service name & description

headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}

'https://www.youtube.com/watch?v=suO6X5U4rmQ',
https://www.bilibili.com/video/BV1zx4y1x7SD/?spm_id_from=333.1007.tianma.1-1-1.click&vd_source=73c4aca839bb90148d5538d4abc316d3’

additional context

import requests

设置请求头

headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}

设置请求体

data = {
'url': 'https://www.youtube.com/watch?v=suO6X5U4rmQ', # 替换为你的视频链接
'isAudioOnly': True # 设置为只获取音频
}

发送POST请求

response = requests.post('https://api.cobalt.tools/api/json', headers=headers, json=data)

解析响应

if response.status_code == 200:
response_data = response.json()
if response_data.get('status') == 'success':
audio_url = response_data.get('audio')
print(f"音频链接: {audio_url}")
else:
print(f"请求失败: {response_data.get('text')}")
else:
print(f"HTTP请求失败: {response.status_code}, 错误信息: {response.text}")

run code result return "请求失败: None"

Originally created by @wanquanY on GitHub (Jul 9, 2024). ### service name & description headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' } ### link samples for the service you'd like cobalt to support 'https://www.youtube.com/watch?v=suO6X5U4rmQ', ‘https://www.bilibili.com/video/BV1zx4y1x7SD/?spm_id_from=333.1007.tianma.1-1-1.click&vd_source=73c4aca839bb90148d5538d4abc316d3’ ### additional context import requests # 设置请求头 headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' } # 设置请求体 data = { 'url': 'https://www.youtube.com/watch?v=suO6X5U4rmQ', # 替换为你的视频链接 'isAudioOnly': True # 设置为只获取音频 } # 发送POST请求 response = requests.post('https://api.cobalt.tools/api/json', headers=headers, json=data) # 解析响应 if response.status_code == 200: response_data = response.json() if response_data.get('status') == 'success': audio_url = response_data.get('audio') print(f"音频链接: {audio_url}") else: print(f"请求失败: {response_data.get('text')}") else: print(f"HTTP请求失败: {response.status_code}, 错误信息: {response.text}") run code result return "请求失败: None"
GiteaMirror added the service request label 2025-11-09 09:46:50 -06:00
Author
Owner

@dumbmoron commented on GitHub (Jul 9, 2024):

what

@dumbmoron commented on GitHub (Jul 9, 2024): what
Author
Owner

@wanquanY commented on GitHub (Jul 9, 2024):

The request api, unable to get audio link to video

@wanquanY commented on GitHub (Jul 9, 2024): The request api, unable to get audio link to video
Sign in to join this conversation.