add regex to get a unique ref from each sitemap/category based article url.

This commit is contained in:
Jason Schwarzenberger
2020-11-17 12:38:28 +13:00
parent f5c7a658ba
commit b771b52501
7 changed files with 86 additions and 38 deletions
+3 -3
View File
@@ -145,12 +145,12 @@ def static_story(sid):
http_server = WSGIServer(('', 33842), flask_app)
def _add_new_refs():
for ref, source in feed.get_list():
for ref, source, urlref in feed.get_list():
if database.get_story_by_ref(ref):
continue
try:
nid = new_id()
database.put_ref(ref, nid, source)
database.put_ref(ref, nid, source, urlref)
logging.info('Added ref ' + ref)
except database.IntegrityError:
continue
@@ -163,7 +163,7 @@ def _update_current_story(item):
logging.info('Updating story: {}'.format(str(story['ref'])))
valid = feed.update_story(story)
valid = feed.update_story(story, urlref=item['urlref'])
if valid:
database.put_story(story)
search.put_story(story)