From 2d200ca75161646d952f4bcb5d2638a64d81490c Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Wed, 19 Jul 2023 15:16:36 -0300 Subject: [PATCH] remove tag as a key, add tag as value to title --- app/models/parser/tiktok_item.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/parser/tiktok_item.rb b/app/models/parser/tiktok_item.rb index ced1f894..ddf14c93 100644 --- a/app/models/parser/tiktok_item.rb +++ b/app/models/parser/tiktok_item.rb @@ -27,27 +27,26 @@ def parse_data_for_parser(doc, _original_url, _jsonld_array) match = url.match(TIKTOK_ITEM_URL) username = match['username'] external_id = match['id'] - tag = '' + title = parsed_data['raw']['api']['title'] elsif url.match(TIKTOK_TAG_URL) username = '' external_id = '' - tag = url.match(TIKTOK_TAG_URL)['tag'] + title = "Tag: " + url.match(TIKTOK_TAG_URL)['tag'] else username = '' external_id = '' - tag = '' + title = parsed_data['raw']['api']['title'] end @parsed_data.merge!({ username: username, external_id: external_id, - description: parsed_data['raw']['api']['title'], - title: parsed_data['raw']['api']['title'], + description: title, + title: title, picture: parsed_data['raw']['api']['thumbnail_url'], author_url: parsed_data['raw']['api']['author_url'], html: parsed_data['raw']['api']['html'], - author_name: parsed_data['raw']['api']['author_name'], - tag: tag + author_name: parsed_data['raw']['api']['author_name'] }) end parsed_data