我做了一个非常简单的API: https://gist.github.com/el3zahaby/9e60f1ae3168c38cc0f0054c15cd6a83
例如:YouTube视频链接:https://www.youtube.com/watch?v = YGCLs9Bt_KY
现在获得直接链接
你需要调用api,像这样:
https://script-url.com/?url=https://www.youtube.com/watch?v=YGCLs9Bt_KY
收益:
[
{
"url": "https:\/\/r10---sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&signature=81D86D3BC3D34D8A3B865464BE7BC54F34C1B0BC.7316033C2DD2F65E4D345CFA890257B63D7FE2A2&mt=1522999783&expire=1523021537&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&requiressl=yes&ei=gSLHWvuxDMOUVYaTqYgB&dur=244.204&pl=22&itag=22&ip=185.27.134.50&lmt=1522960451860848&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&ratebypass=yes&ms=au%2Conr&fvip=2&source=youtube&mv=m&ipbits=0&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&mime=video%2Fmp4&c=WEB&initcwndbps=710000",
"quality": "hd720",
"itag": "22",
"type": "video\/mp4; codecs=\"avc1.64001F, mp4a.40.2\""
},
{
"url": "https:\/\/r10---sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&mt=1522999783&gir=yes&expire=1523021537&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&itag=43&ratebypass=yes&fvip=2&ipbits=0&mime=video%2Fwebm&initcwndbps=710000&signature=71DC48B9BF4B2E3ED46FE0A4CD36FE027DACF31E.4624B7B4BCB947336CEB029E9958B136F79759EB&clen=24203231&requiressl=yes&dur=0.000&pl=22&ip=185.27.134.50&lmt=1522961642553275&ei=gSLHWvuxDMOUVYaTqYgB&ms=au%2Conr&source=youtube&mv=m&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&c=WEB",
"quality": "medium",
"itag": "43",
"type": "video\/webm; codecs=\"vp8.0, vorbis\""
},
{
"url": "https:\/\/r10---sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&mt=1522999783&gir=yes&expire=1523021537&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&itag=18&ratebypass=yes&fvip=2&ipbits=0&mime=video%2Fmp4&initcwndbps=710000&signature=C83DE33E3DC80981A65DB3FE4E6B3A48BF7500E4.361D0EE6210B30D3D3A80F43228DEF1BD20691A4&clen=15954979&requiressl=yes&dur=244.204&pl=22&ip=185.27.134.50&lmt=1522960340235683&ei=gSLHWvuxDMOUVYaTqYgB&ms=au%2Conr&source=youtube&mv=m&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&c=WEB",
"quality": "medium",
"itag": "18",
"type": "video\/mp4; codecs=\"avc1.42001E, mp4a.40.2\""
},
{
"url": "https:\/\/r10---sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&mt=1522999783&gir=yes&expire=1523021537&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&itag=36&fvip=2&ipbits=0&mime=video%2F3gpp&initcwndbps=710000&signature=3E993D911492DA039A16BB26182ACDC6C6A04FCC.BFB9728C71CD03970B0F15AFD51A7355F9D3F899&clen=6759799&requiressl=yes&dur=244.273&pl=22&ip=185.27.134.50&lmt=1522957367267598&ei=gSLHWvuxDMOUVYaTqYgB&ms=au%2Conr&source=youtube&mv=m&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&c=WEB",
"quality": "small",
"itag": "36",
"type": "video\/3gpp; codecs=\"mp4v.20.3, mp4a.40.2\""
},
{
"url": "https:\/\/r10---sn-aigllnlr.googlevideo.com\/videoplayback?key=yt6&mt=1522999783&gir=yes&expire=1523021537&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&itag=17&fvip=2&ipbits=0&mime=video%2F3gpp&initcwndbps=710000&signature=810D13A2C507A4EA220E6DA895B39B237FA22DAF.898D020851087CF3C10BC6E3ED7360736A239904&clen=2443931&requiressl=yes&dur=244.273&pl=22&ip=185.27.134.50&lmt=1522957365473654&ei=gSLHWvuxDMOUVYaTqYgB&ms=au%2Conr&source=youtube&mv=m&id=o-AAoaDzyDCVXS404wfqZoCIdolGU-NM3-4yDxC0t868iL&mm=31%2C26&mn=sn-aigllnlr%2Csn-5hne6nsy&c=WEB",
"quality": "small",
"itag": "17",
"type": "video\/3gpp; codecs=\"mp4v.20.3, mp4a.40.2\""
}
]
更新:
看到源代码:
GIST:https://gist.github.com/el3zahaby/9e60f1ae3168c38cc0f0054c15cd6a83
- @DevinSmith 如果您在 GitHub Gist 上看到广告,我可能有一些关于您的计算机上可能正在运行的软件种类的坏消息。 (3认同)
小智 6
抱歉,先生,您无法使用 youtube api v3 执行此操作。您必须使用 youtube 的 url,它不是 api,但在这里您可以获得与此相关的所有视频。请参阅 http://www.youtube.com/get_video_info?&video_id= '。$my_id.'&asv=3&el=detailpage&hl=en_US
或者您可以获取所有视频下载链接,即使它是私人的或不允许您的国家/地区使用 1st:转到 youtube 视频链接的任何网页https://www.youtube.com/watch?v=9mdJV5-eias
第二:查看该页面的源代码
第 3 行:188 或 187 行,您可以在其中找到源 Javascript 代码,其中还提供了 mp4 格式视频的位置。
你可以通过 simplehtmldom 和一些 php 函数来做第二个想法。第一个可以通过使用 curl 获得,这很容易,但通过 php 有点困难。谢谢你希望这会帮助你。
来源
没有评论:
发表评论
注意:只有此博客的成员才能发布评论。