2

I am trying to get response of website using JSoup.

I am able to get the response of website using JSoup as follows, it returns the desktop website's response

    String str = "http://hplus.com.vn/xem-tivi-htv9-full-hd-1080-52834.html";
     doc = Jsoup.connect(str)
                .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36")
                .get();  

Same way, I am trying to get the response for mobile version to this same site as follows,

 doc = Jsoup.connect("http://hplus.com.vn/xem-tivi-htv9-full-hd-1080-52834.html")
                    .userAgent("Mozilla/5.0(Linux; U; Android 4.2; en-gb; LG-P500 Build/FRF91) AppleWebKit/533.0 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
                    .get();   

But this gives only desktop/laptop version response and not the mobile response. Picture Format web :

enter image description here Picture Format mobile :

enter image description here

How to get the mobile response from jsoup.

Thanks in advance.

BackSlash
  • 21,927
  • 22
  • 96
  • 136
Xuân Mai
  • 45
  • 1
  • 10
  • Are you sure there is a mobile version of the website? 90% websites are built so that the UI is responsive, so you have just one website which fits all screen sizes. And actually the site you mentioned changes when resizing the browser window, so I really think there is no dedicated mobile version at all – BackSlash Mar 13 '17 at 10:20
  • yeah. well. I've checked but two different website structures. This is photo illustrated : picture mobile http://sv1.upsieutoc.com/2017/03/13/mobile.png picture web : http://sv1.upsieutoc.com/2017/03/13/web.png – Xuân Mai Mar 13 '17 at 11:48
  • It's all decided by javascript. Browse the source code (CTRL+U on most browsers, **not F12**) and search for "ios-player". You'll see that at line 1214 there is a js function that creates the element. Javascript isn't executed b JSoup so you'll have to emulate a browser to execute it – BackSlash Mar 13 '17 at 11:52
  • so can you tell me how to get the stream ios-player . please support. – Xuân Mai Mar 13 '17 at 11:55
  • http://stackoverflow.com/questions/7344258/jsoup-java-html-parser-executing-javascript-events – BackSlash Mar 13 '17 at 11:56
  • so it will not get used jsoup value :( – Xuân Mai Mar 13 '17 at 12:03

0 Answers0