scrapp post
This commit is contained in:
parent
778366b30c
commit
9e48b92d3e
@ -39,8 +39,12 @@ def count_predictions(predictions):
|
||||
return all
|
||||
|
||||
def scrapp_comments(url):
|
||||
result = []
|
||||
comments= []
|
||||
all = {}
|
||||
for post in get_posts(post_urls=[url], options={"allow_extra_requests": False, "comments":True, "extra_info":True}):
|
||||
text_post = post['text']
|
||||
for comment in post['comments_full']:
|
||||
result.append(comment['comment_text'])
|
||||
return result
|
||||
comments.append(comment['comment_text'])
|
||||
all['post'] = text_post
|
||||
all['comments'] = comments
|
||||
return all
|
||||
|
@ -24,5 +24,5 @@ def get_data():
|
||||
@sentiment_service.route("/scrapp_comments", methods=['POST'])
|
||||
def scrapp():
|
||||
url = request.get_json()
|
||||
comments = scrapp_comments(url['link'])
|
||||
return jsonify({'sentences':comments})
|
||||
result = scrapp_comments(url['link'])
|
||||
return result
|
Loading…
Reference in New Issue
Block a user