Getting mobile search results using API v1
Written by
Updated at December 27, 2024
Mobile search results differ from default search results by the ranking formula and presence of links to websites optimized for mobile devices.
To get mobile search results:
-
Add to your request a header
entitleduser-agent
containing the device and browser description. Here is an example:cURLPythoncurl \ --header 'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' \ '<GET request>'
import subprocess MOBILE_HEADER = 'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1' URL = f'<GET request>' with open('mob.xml', 'w') as f: subprocess.run(['curl', '-H', MOBILE_HEADER, URL], stdout=f)
Note
The above example uses a GET request. If using a POST request, add a similar header.
-
Set the remaining request parameters based on the specification and send the request.
Mobile search results will be different from default search results by the website ranking, total number of results found, and some other parameters.