def run(self, url, thematic=None, user_id=None, source=None): if not (url.startswith("http://") or url.startswith("https://")): url = "http://%s" % url # parse the web page res = requests.get("http://www.readability.com/api/content/v1/parser?url=%s&token=%s" % (url, app.config['READABILITY_PARSER_TOKEN'])) parsed = res.json() # save the article article = Article() article.title = parsed['title'] article.date = parsed['date_published'] article.content = parsed['content'] article.summary = parsed['excerpt'] article.link = parsed['url'] article.domain = parsed['domain'] article.count_words = parsed['word_count'] article.user = user_id article.thematic = thematic article.type = source article.save() # EOF
def run(self, url, thematic=None, user_id=None, source=None): if not (url.startswith("http://") or url.startswith("https://")): url = "http://%s" % url # parse the web page res = requests.get( "http://www.readability.com/api/content/v1/parser?url=%s&token=%s" % (url, app.config['READABILITY_PARSER_TOKEN'])) parsed = res.json() # save the article article = Article() article.title = parsed['title'] article.date = parsed['date_published'] article.content = parsed['content'] article.summary = parsed['excerpt'] article.link = parsed['url'] article.domain = parsed['domain'] article.count_words = parsed['word_count'] article.user = user_id article.thematic = thematic article.type = source article.save() # EOF