Since the Soundcloud Java API is discontinued, I want to perform a search on their site using JSoup. I am currently using this code:
Document doc = Jsoup
.connect("https://soundcloud.com/search?q=deep%20house")
.userAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36")
.timeout(5000).get();
But the webpage is giving me a message that I should be using a newer browser:
<p class="messageText sc-text-light">Your current browser isn't compatible with SoundCloud.<br>Please download one of our supported browsers. Need help?</p>
I have tried using other user agents which I found here but none seems to work so far. What can I do to prevent this message from popping up?
You can try the below snippet. User agent string taken from this thread.
Document doc = Jsoup
.connect("https://soundcloud.com/search?q=deep%20house")
.userAgent("Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
.timeout(5000).get();
System.out.println(doc);
Related
I want to use WhatsAppWeb (web.whatsapp.com) in an Android app. I've tried using a WebView and load the URL but I'm redirected to the regular WhatsApp page (www.whatsapp.com). I tried changing the User Agent
mWebView.getSettings().SetUserAgentString("Mozilla / 5.0 (Windows NT 10.0; Win64; x64) AppleWebKit / 537.36 (KHTML, like Gecko) Chrome / 78.0.3945.79 Safari / 537.36");
but this only works if the app is started the first time. Each further start it redirects. Deleting Cache works (no redirect) but then I have to "authenticate" the device again.
Any ideas?
Did you try using custom webview client? Please check this http://www.technotalkative.com/android-webviewclient-example/
I want to show a website in Android Studio with the web-view. The Website doesn´t load but there is a message:
TO use this site: Please use a standard-compliants web browser such as Safari 4.0+, Chrome or Firefox 15.0+, JavaScript must be enabled to use this site.
And I have enabled Javascript.
Do you know what I can do that the website loads anyway?
WebView w = (WebView) findViewById(R.id.w);
WebSettings ws = w.getSettings();
ws.setJavaScriptEnabled(true);
w.loadUrl("https://www.supremenewyork.com/mobile/");
You can try to add user-agent string like this :
ws.setUserAgentString("Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36");
You can get a list of user agents here :
https://developers.whatismybrowser.com/useragents/explore/
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 :
Picture Format mobile :
How to get the mobile response from jsoup.
Thanks in advance.
`Hi,
I am trying to get the user's browser information in my servlet filter. I used a simple code, see below.
String userAgent = request.getHeader("User-Agent");
User was using Google chrome, and what the above code printed is below.
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
It printed the names of all the major browsers instead of getting the once the app is running. what is wrong here?
Nothing is wrong here.
For example let us consider the returned string is
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36
Then the explanation is
ChromeChrome 41.0.2228.0
Mozilla ==>
MozillaProductSlice. Claims to be a Mozilla based user agent, which is only true for Gecko browsers like Firefox and Netscape. For all other user agents it means 'Mozilla-compatible'. In modern browsers, this is only used for historical reasons. It has no real meaning anymore
5.0 ==> Mozilla version
Windows NT 6.1 ==> Operating System Windows 7
AppleWebKit ==> The Web Kit provides a set of core classes to display web content in windows
537.36 ==> Web Kit build
KHTML ==> Open Source HTML layout engine developed by the KDE project
like Gecko ==> like Gecko...
Chrome Name ==> Chrome
41.0.2228.0 ==> Chrome version
Safari ==> Based on Safari
537.36 ==> Safari build
Description: Free open-source web browser developed by Google.
Chromium is the name of the open source project behind Google Chrome, released under the BSD license.
You can find more information in below link
http://www.useragentstring.com/pages/Chrome/
click on each link on the page to get more info
I got the following information using request.getHeader("User-Agent") method inside a Servlet:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.224 Safari/534.10
Actually what is the client browser?
It's Chrome 8.0.552.
This website may be useful for future consultations: http://user-agent-string.info. Paste the UA string there and click Analyze. They have even a XML-RPC webservice.