For example, take baidu.com. For other services, an algorithm will be about the same.
First you need to find URL, which returns suggestions as you type in the search box. For this I use the developer tools in Chrome.
So, with a request, and knowing how the result looks, make a preset on the basis of
Net::HTTP, with parsing JSON and output only suggests using a template engine capabilities. Also, using tools.query.add can implement substitution obtained suggests back to queries, i.e. parse in depth (in examle - 2).
Example of result:
First you need to find URL, which returns suggestions as you type in the search box. For this I use the developer tools in Chrome.
- Open http://www.baidu.com/ in browser.
- Writing any request, for example test
- Open the Developer Tools (Ctrl+Shift+I), switch to the Network tab.
- Put the cursor in the search box, it is possible to add some character (for example space). It is necessary that displays suggests.
- In the Tools see sent requests. We are looking for the one that returns a suggests.
- On the screenshot highlighted just what we need (the first request). I recommend for convenience to remove the excess parameters from the query, experiment with it in a browser. But it should be done with extreme care, because happens that by removing some of the parameters, the result is quite different. In the example, the query looks like this:
Code:http://suggestion.baidu.com/su?wd=test&sugmode=2&json=1&p=3&sid=18881_18728_1431_18241_18878_12825_18730_18767_18777_18546_18779_17000_18782_17073_15729_11820_17999_10633&req=2&bs=test&pbs=test&csor=4&cb=jQuery11020484825603896752_1452509913872&_=1452509913893 - After cutting it will look like this:
Code:http://suggestion.baidu.com/su?wd=test&json=1&req=2&bs=test&pbs=test
In fact it is JSON, but enclosed in parentheses.window.baidu.sug({"q":"test","p":false,"bs":"test","csor":"0","g":[ { "q": "testing", "t": "n", "st": { "q": "testing", "new": 0 } }, { "q": "test 汇编", "t": "n", "st": { "q": "test 汇编", "new": 0 } }, { "q": "testin云测试平台", "t": "n", "st": { "q": "testin云测试平台", "new": 0 } }, { "q": "testng", "t": "n", "st": { "q": "testng", "new": 0 } }, { "q": "testerhome", "t": "n", "st": { "q": "testerhome", "new": 0 } }, { "q": "test()", "t": "n", "st": { "q": "test()", "new": 0 } }, { "q": "test js", "t": "n", "st": { "q": "test js", "new": 0 } }, { "q": "testlink", "t": "n", "st": { "q": "testlink", "new": 0 } }, { "q": "testflight", "t": "n", "st": { "q": "testflight", "new": 0 } }, { "q": "testo", "t": "n", "st": { "q": "testo", "new": 0 } } ],"s":["testing","test 汇编","testin云测试平台","testng","testerhome","test()","test js","testlink","testflight","testo"]});
So, with a request, and knowing how the result looks, make a preset on the basis of
Net::HTTP, with parsing JSON and output only suggests using a template engine capabilities. Also, using tools.query.add can implement substitution obtained suggests back to queries, i.e. parse in depth (in examle - 2).
Code:
eyJwcmVzZXQiOiJCYWlkdSBzdWdnZXN0cyIsInZhbHVlIjp7InByZXNldCI6IkJh
aWR1IHN1Z2dlc3RzIiwicGFyc2VycyI6W1siTmV0OjpIVFRQIiwiZGVmYXVsdCIs
eyJ0eXBlIjoib3ZlcnJpZGUiLCJpZCI6Imdvb2RDb2RlIiwidmFsdWUiOjIwMH0s
eyJ0eXBlIjoiY3VzdG9tUmVzdWx0IiwicmVzdWx0IjoiZGF0YSIsInJlZ2V4Ijoi
XFwoKC4rPylcXCk7IiwicmVnZXhUeXBlIjoiIiwicmVzdWx0VHlwZSI6ImZsYXQi
LCJhcnJheU5hbWUiOiIiLCJyZXN1bHRzIjpbImpzb25kYXRhIl19XV0sInJlc3Vs
dHNGb3JtYXQiOiJbJSBsZXZlbCA9IDI7ICNcdTA0MTNcdTA0M2JcdTA0NDNcdTA0
MzFcdTA0MzhcdTA0M2RcdTA0MzAgXHUwNDNmXHUwNDNlXHUwNDM0XHUwNDQxXHUw
NDQyXHUwNDMwXHUwNDNkXHUwNDNlXHUwNDMyXHUwNDNhXHUwNDM4IFx1MDQzZlx1
MDQzZVx1MDQzNFx1MDQ0MVx1MDQzYVx1MDQzMFx1MDQzN1x1MDQzZVx1MDQzYSwg
MCBcdTA0MzRcdTA0M2JcdTA0NGYgXHUwNDNlXHUwNDQyXHUwNDNhXHUwNDNiXHUw
NDRlXHUwNDQ3XHUwNDM1XHUwNDNkXHUwNDM4XHUwNDRmXG5cbiNcdTA0MTJcdTA0
NGJcdTA0MzJcdTA0M2VcdTA0MzQgXHUwNDNmXHUwNDNlXHUwNDM0XHUwNDQxXHUw
NDN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OiJubyIsImtlZXBVbmlxdWUiOiJObyIsIm1vcmVPcHRpb25zIjpmYWxzZSwi
cmVzdWx0c1ByZXBlbmQiOiIiLCJyZXN1bHRzQXBwZW5kIjoiIiwicXVlcnlCdWls
ZGVycyI6W10sInJlc3VsdHNCdWlsZGVycyI6W10sImNvbmZpZ092ZXJyaWRlcyI6
W119fQ==
Example of result:
test 汇编
testin云测试平台
test()
testing
testng
test1
testerhome
test js
testlink
testflight
testlink下载
testlink 安装
testlink使用教程
testlink导出excel
testlink汉化
testlink jira集成
testlink导入excel
testlink和禅道能够集成嘛
testlink excel
testlink1.9.14
test 汇编指令
test al,80h 汇编
test 汇编命令
test汇编
js test()
jquery test()
test和exam的区别
python test()
jquery test() ie8不兼容
test 正则表达式
test() val()
test()和test()
test()验证身份证号
test(3,7,7)
test123
test1.5
test1.5是什么软件
test11
test10095
test10097
test1 completed
test101
新概念2test1
test40011
testlink下载安装
testlink1.9.14
testlink安装 linux
testlink下载后怎么运行
testlin下载
testflight怎么用
testflight 内部测试
testflight外部测试
testflight审核要多久
testflight invitation code
testflight构建版本
test flight内部测试 版本选不上
test flight邀请码过期
testflight app怎么用
testflight 开发商证书已失效
test() js
test json
js test()
test jstl
test是什么意思
tests
teststand
testspeed
teststand中文教程
test汇编指令
testin云测试
testin云测试平台
...