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