Commit d51db783 authored by huangziyu's avatar huangziyu

1

parent 23028eaa
...@@ -42,7 +42,7 @@ def remove_html_tags(text): ...@@ -42,7 +42,7 @@ def remove_html_tags(text):
url_data = mysql_zdzs_proxy( url_data = mysql_zdzs_proxy(
"SELECT id,url,mallId FROM DMP_SEARCH_SPIDER WHERE ID NOT IN (SELECT ID FROM DMP_SEARCH_DATA) and mallId = 'DS-JD' and project_id = '110' and (id like '%4' or id like '%5' or id like '%6' or id like '%7' ) limit 10000") "SELECT id,url,mallId FROM DMP_SEARCH_SPIDER WHERE ID NOT IN (SELECT ID FROM DMP_SEARCH_DATA) and mallId = 'DS-JD' and project_id = '100' and (id like '%4' or id like '%5' or id like '%6' or id like '%7' ) limit 10000")
for row in url_data: for row in url_data:
url = row['url'] url = row['url']
keyword = url.replace('https://search.jd.com/search?keyword=', "").replace('&enc=utf-8', "") keyword = url.replace('https://search.jd.com/search?keyword=', "").replace('&enc=utf-8', "")
...@@ -67,12 +67,15 @@ for row in url_data: ...@@ -67,12 +67,15 @@ for row in url_data:
dataList = [] dataList = []
if response_json != {}: if response_json != {}:
for sku_info in response_json['291']: for sku_info in response_json['291']:
shop_name = ''
if 'shop_name' in sku_info['shop_link']:
shop_name = sku_info['shop_link']['shop_name']
dataList.append( dataList.append(
{ {
'is_self_operate_div': '', 'is_self_operate_div': '',
'item_url': 'https://item.jd.com/' + str(sku_info['sku_id']) + '.html', 'item_url': 'https://item.jd.com/' + str(sku_info['sku_id']) + '.html',
'sku_id': str(sku_info['sku_id']), 'sku_id': str(sku_info['sku_id']),
'shop_name': sku_info['shop_link']['shop_name'], 'shop_name': shop_name,
'sku_name': remove_html_tags(sku_info['ad_title']), 'sku_name': remove_html_tags(sku_info['ad_title']),
'sku_price': sku_info['sku_price'], 'sku_price': sku_info['sku_price'],
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment