html src 隐藏
尝试使用 HttpClient 读取网页。但是一些 html 被一些 js 魔法隐藏了,尝试点击此页面上的查看源代码http://uc.worldoftanks.eu/uc/accounts/#wot&at_search=a
知道如何让 HttpClient 返回“完整”的 html 页面吗?
Trying to read a webpage using HttpClient. But some of the html is hidden by some js magic, try hitting view source on this page http://uc.worldoftanks.eu/uc/accounts/#wot&at_search=a
Any idea how to get HttpClient to return the "full" html page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
HttpClient
不处理 javascript,这意味着从服务器读取 http 内容时没有可以隐藏的内容。可能恰恰相反,页面上运行的 JavaScript 可能创建新的 html 元素并将它们附加到 DOM...这不是您可以使用 HttpClient 处理的事情>,
HttpClient
是一个纯粹为通过 HTTP 连接读取数据而设计的通信客户端。HttpClient
does not process javascript, which means there is no content that can be hidden when reading the http content from the server.It's probably the other way round, the javascript that runs on the page likely creates new html elements and appends them to the DOM... which is not something you can handle using
HttpClient
,HttpClient
is a communication client designed purely to read data accross a HTTP connection.continue
When that page loads, a request is being sent to
http://uc.worldoftanks.eu/uc/accounts/?type=table&offset=0&limit=25&order_by=name&search=a&echo=1&id=accounts_index
Try hitting that address up with your HttpClient to see the table data. Play with the
offset
,limit
andorder_by
values to change pagination and sorting.Manually browsing to said URL yields a redirect, though, so there appears to be some of the Request headers that you need to include in your HttpClient. The full headers of the request my browser issues, that does yield a JSON response with the table data, is as follows:
They might be looking for
X-Requested-With
orAccept
orReferrer
, for instance.