Skip to content

Commit

Permalink
deal with deleted vimeos
Browse files Browse the repository at this point in the history
  • Loading branch information
elomar committed Jun 16, 2013
1 parent 6c06852 commit 6d385c2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/models/articles_retriever.rb
Expand Up @@ -54,7 +54,12 @@ def embed_info_uri
end

def info
HTTParty.get(info_uri).first
response = HTTParty.get(info_uri)
if response.code > 400
{ "duration" => 0 }
else
response.first
end
end

def info_uri
Expand Down Expand Up @@ -110,6 +115,8 @@ def build_article(pocket_item)
end

def parser_for(pocket_item)
return nil unless pocket_item["is_article"].to_i == 1 or pocket_item["has_video"].to_i == 2

case pocket_item["has_video"].to_i
when 0 then TextParser.new(url: pocket_item["resolved_url"], words: pocket_item["word_count"].to_i)
when 2 then video_parser(pocket_item["resolved_url"])
Expand Down

0 comments on commit 6d385c2

Please sign in to comment.