How to convert a link that has javascript:__doPostBack in href to normal url which wget/curl/lynx can understand?

本小妞迷上赌 提交于 2019-12-23 03:55:08

问题


I searched in SO first, and found this question. How to click a link that has javascript:__doPostBack in href? but it gives the answer in python only.

What I need is, when go through a website, some pages (2,3,4, etc) with links like below:

javascript:__doPostBack('AspNetPager1','2')
javascript:__doPostBack('AspNetPager1','3')
javascript:__doPostBack('AspNetPager1','4')

If I click it, and it will display the next page, but the real url isn't displayed in browser.

So my questions is, how can I convert the javascript link into traceable real url and feed to wget/curl/lynx?

My purpose is to use the tools (wget/curl/lynx) to download these pages one by one by scripting. But because of these javascript:__doPostBack, I can't find a good way to do it.


回答1:


You can't really do it analytically. __doPostBack could be arbitrarily complex.

What you should do instead is install Firebug (assuming you are using Firefox), activate the Network tab, press "Persist", and then click that button. The Network tab will show you the actual network traffic, and you can deduce the real URLs from that. In fact, you can just right-click on the particular network request that interests you and select "Copy as cURL" and it will put the curl instructions -- complete with things like cookies and headers -- in your paste buffer.

There is a similar function built-in to Chrome.



来源:https://stackoverflow.com/questions/23210403/how-to-convert-a-link-that-has-javascript-dopostback-in-href-to-normal-url-whi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!