API Documentation — Elasticsearch 6.3.1 documentation https://elasticsearch-py.readthedocs.io/en/master/api.html
import os, json, re kw_d = {'悠牛': 'u69cn.com', '际通宝': 'gtobal.com', '贸商网': 'mao35.com', '客集齐网': 'kejiqi.com', '企业谷': 'qiyegu.com',
'搜了网': '51sole.com', '搜了网': '51sole.com'} from elasticsearch import Elasticsearch
import random es = Elasticsearch(
['11.7.217.10:9200', '10.5.32.114:9200', '10.6.84.7:9200', '10.2.192.92:9200'],
) while True:
for kw in kw_d:
curl = 'curl -d "keyword={}" http://59.1.16.24/Diad/iex/inex'.format(kw)
r = os.popen(curl)
info = r.readlines()
m_str = '^.+' + kw_d[kw] + '.+$'
print(m_str)
t = json.loads(info[0])
url_l = [i['url'] for i in t if re.match(m_str, i['url']) is not None]
a = random.randint(0, 1000)
b = random.randint(a, 1000)
while b < a:
b = random.randint(a, 1001)
for i in url_l[a:b]:
try:
print(i)
# index, doc_type, id
r = es.delete('direct_vote', 'kwaddress', i)
print(r)
except Exception as e:
print(e)