获取完整的 html 源代码并绕过
好的,所以我正在尝试使用 mp3 转换器制作一个 youtube 下载器
有一个很棒的网站可以为我做这件事...
我可以发送链接并它处理信息...
但是当我要使用源下载时(提取链接),它只是给了我
<noscript>
<div class="warning">You have to enable JavaScript to use this Service!</div>
并且链接不存在
如果我使用 Chrome,来源是:
<div id="dl_link" style="display: block; "> <a href="/get?video_id=UA8rcLvS1BY&h=8a4dfe7979a47aae13e47dad3999d09e"> <b>Download</b></a> · <a href="#" onclick="showLinkBox(); return false;">Link this mp3</a></div>
如何在用户不单击任何内容的情况下获取并下载它!
Ok, so I am trying to make a youtube downloader with mp3 converter
There is this awesome site that does it for me...
I can send the link and it processes the information...
However when I am about to download using the source (extracting link), it just gives me
<noscript>
<div class="warning">You have to enable JavaScript to use this Service!</div>
And the link is not present
If i use chrome, the source is:
<div id="dl_link" style="display: block; "> <a href="/get?video_id=UA8rcLvS1BY&h=8a4dfe7979a47aae13e47dad3999d09e"> <b>Download</b></a> · <a href="#" onclick="showLinkBox(); return false;">Link this mp3</a></div>
How do I get it and download it without the user clicking anything!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
curl 似乎支持它。尝试使用 Process.Start 调用它?
curl seems to support it. Try calling that with
Process.Start
?猜测第一:他们的网站使用请求标头来确定您使用的浏览器是否支持 javascript...
尝试设置 User-Agent http 标头在您发出请求时模仿合适的浏览器,并查看它们是否以正确的响应进行响应。
更新
由于猜测离谱,需要更多信息,我建议使用 Fiddler 来工作找出您的浏览器与其服务之间来回发送的内容,并尝试在您的代码中重现此行为。
Guess number one: Their site uses the request headers to figure out if the browser you're using supports javascript...
Try setting the User-Agent http header to mimic a suitable browser when you make your request and see if they respond with the correct response.
Update
Since guess one was wide of the mark, more information is required, I'd suggest using Fiddler to work out what is being sent back and forth between your browser and their service, and try to reproduce this behaviour in your code.