Getting mobile search results
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:
-
In the program code for the search object (
sdk.search_api.webclass object), give a description of the User-Agent header of required device and browser. For example, you can do this in theuser_agentproperty of the.configuremethod:mobile-search.py
... search = search.configure( search_type="ru", family_mode="strict", ... 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", ) ... -
Set the rest of the search query parameters as in Performing text search queries in deferred mode.
-
Run the code and get the result.
-
Add the
userAgentfield to the request body. This field contains a description of the User-Agent header of the device and browser. Here is an example:body.json
{ ... "userAgent": "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" } -
Set the other request body parameters according to the specification.
-
Send the request and get the result. For more information, see Performing text search queries in deferred mode.
-
Add the
user_agentfield to the request body. This field contains a description of the User-Agent header of the device and browser. Here is an example:body.json
{ ... "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" } -
Set the other request body parameters according to the specification.
-
Send the request and get the result. For more information, see Performing text search queries in deferred mode.
Mobile search results will be different from default search results by the website ranking, total number of results found, and some other parameters.