search

Home  >  Q&A  >  body text

python - 如何用java获取一个网站的网络传输中的request URL。

类似于抓包。我们在chrome开发者工具中看到Network传输的请求,可以用java获取到嘛?

PHPzPHPz2893 days ago362

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:40:51

    Java is a programming language, not a packet capture and analysis tool.
    If those URLs originally exist in the web page, you can use regular expressions to match them~
    If the URL is dynamically generated, it will be more laborious to analyze the algorithm.


    If you just want to get the video file, you can find it from the browser's cache folder.
    Chrome’s cache folder is generally called Cache
    First clear the cache folder, then watch the video. After the video buffersis completed, copy the files in the cache folder and change the extension to the corresponding format.
    For example: .mp4 ; .flv

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:40:51

    It can be obtained, if you use the springMVC framework
    //The current requested url
    String url = request.getRequestURL().toString();
    //query is everything after the question mark in the url
    String queryString = request.getQueryString();
    In addition, the content of the request header can also be obtained, please see Du Niang for details

    reply
    0
  • Cancelreply