diff --git a/lambda/crawler/crawler.rb b/lambda/crawler/crawler.rb index 30e91d1..60e9c32 100644 --- a/lambda/crawler/crawler.rb +++ b/lambda/crawler/crawler.rb @@ -24,6 +24,7 @@ def search def save @fashion_check_tweets.each do |tweet| begin + next unless tweet.valid? @dynamodb.put_item(tweet.dynamo_params) rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException puts "DynamoDB put_item failed. url: #{tweet.tweet_url}" diff --git a/lambda/crawler/fashion_check_tweet.rb b/lambda/crawler/fashion_check_tweet.rb index 449f503..3b8e3aa 100644 --- a/lambda/crawler/fashion_check_tweet.rb +++ b/lambda/crawler/fashion_check_tweet.rb @@ -33,7 +33,7 @@ def valid? private def parse - @account_id = @tweet.user.name + @account_id = @tweet.user.screen_name @tweet_url = @tweet.url.to_s @image_url = @tweet.user.profile_image_url.to_s score_text = @tweet.text.match(TWEET_TEMPLATE_JP) || @tweet.text.match(TWEET_TEMPLATE_EN)