Skip to content

Commit 3706fcd

Browse files
committed
add the user
1 parent 0de3b6f commit 3706fcd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎58tongcheng/page_parsing.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ def get_item_info(url):
3636
if no_longer_exist:
3737
pass
3838
else:
39-
title = soup.title.text
39+
title_soup = soup.title.text
40+
title = title_soup.split('_')[0]
41+
user = title_soup.split('_')[1].split('-')[0].split('的闲置物品')[0]
4042
price = soup.select('span.price_now i')[0].text
4143
area = soup.select('.palce_li span i')[0].text # if soup.find_all('span', 'c_25d') else None
42-
item_info.insert_one({'title': title, 'price': price, 'area': area, 'url': url})
43-
print {'title': title, 'price': price, 'area': area}
44+
item_info.insert_one({'title': title, 'price': price, 'area': area, 'url': url, 'user': user})
45+
print {'title': title, 'price': price, 'area': area, 'user': user}

0 commit comments

Comments
 (0)