摩尔庄园手游粉雪若何掉落踪掉落踪?摩尔庄园手游粉雪最新掉落踪掉落踪编制分享

知识 5666℃

WAP网站是站啥啥 ?wap是挪动端仍是手机端?python百度下拉框关头词华集源码 :

01#百度下拉框关头词华集
02importrequests
03importjson
04importurllib
05
06defget_keywords(word): #掉落踪掉落踪下拉词json数据并前去数组
07    url=f"https://www.百度.com/sugrec?pre=1&ie=utf-8&json=1&prod=pc&wd={ word}"
08    html=requests.get(url)
09    html=html.json()
10    #print(html)
11    #print(html['g'])
12    key_words=[]
13    forkey_word inhtml['g']:
14        print(key_word['q'])
15        key_words.append(key_word['q'])
16    #print(key_words)
17    returnkey_words
18
19defget_sug(word): #掉落踪掉落踪下拉词json数据并前去数组2
20    url ='https://sp0.百度.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=%s&sugmode=2&json=1&p=3&sid=1427_21091_21673_22581&req=2&pbs=%%E5%%BF%%AB%%E6%%89%%8B&csor=2&pwd=%%E5%%BF%%AB%%E6%%89%%8B&cb=jQuery11020924966752020363_1498055470768&_=1498055470781'%word
21    r =requests.get(url, verify=False# 请求API接口,消弭了HTTPS验证
22    cont =r.content  # 掉落踪掉落踪前去的动端内容
23    res =cont[41: -2].decode('gbk'# 只取前去下场中json格式一段 ,并且解码为unicode
24    res_json =json.loads(res)  # json格式转换
25    returnres_json['s'# 前去关头词列表
26
27defget_word(word): #掉落踪掉落踪下拉词json数据并前去数组3
28    url=f'http://suggestion.百度.com/su?仍手wd={ word}&sugmode=3&json=1'
29    html=requests.get(url).text
30    html=html.replace("window.百度.sug(",'')
31    html =html.replace(")", '')
32    html =html.replace(";", '')
33    #print(html)
34    html =json.loads(html)
35    key_words=html['s']
36    #print(key_words)
37    returnkey_words
38
39defget_word_scv(): #掉落踪掉落踪下拉词json数据并写进excel
40    opencsv=open('word.csv','a+')
41    forword inopen('gjc.txt',encoding='utf-8'):
42        print(urllib.parse.quote_plus(word))
43        url='https://sp0.百度.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?wd=%s&sugmode=2&json=1&p=3&sid=1427_21091_21673_22581&req=2'%urllib.parse.quote_plus(word)
44        html=requests.get(url).text
45        html=html.replace('window.百度.sug(','')
46        html=html.replace(');','')
47        #print (html)
48        html=json.loads(html)
49        #print (html['s'])
50        fori inhtml['s']:
51            print(i)
52            opencsv.write('%s\n'%i)
53
54defget_more_word(word): #查询所以下拉词并往除几回
55    more_word=[]
56    fori in'abcdefghijklmnopqrstuvwxyz':
57        more_word.extend(get_keywords('%s%s'%(word,i)))
58    print(more_word)
59    print(len(more_word))
60    print(len(list(set(more_word))))
61    returnlist(set(more_word))  #往重独霸
62
63
64defget_more_sug(word): #查询所以下拉词并往除几回
65    all_words =[]
66    fori in'abcdefghijklmnopqrstuvwxyz':
67        all_words +=get_sug(word+i)  # 遍历字母表 | 独霸了上一个函数
68    print(len(list(set(all_words))))
69    returnlist(set(all_words))  # 往重

供给多种python百度下拉框关头词华团编制,基于百度API接口完成 ,机端可导出到Excel表格  ,站啥本文供给4个群集函数及两个汇总函数,动端屈就本身的仍手需求矫捷独霸。

机端