Method: Forki::PostScraper#check_if_post_is_video

Defined in:
lib/forki/scrapers/post_scraper.rb

#check_if_post_is_video(graphql_objects) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/forki/scrapers/post_scraper.rb', line 66

def check_if_post_is_video(graphql_objects)
  result = graphql_objects.find do |graphql_object|
    next unless graphql_object.dig("viewer", "news_feed").nil? # The new page loads the news feed *and* the post
    next unless graphql_object.dig("node", "sponsored_data").nil? # Ads sneak in too but don't mark as feed

    result = graphql_object.to_s.include?("videoDeliveryLegacyFields")
    result = graphql_object.key?("is_live_streaming") && graphql_object["is_live_streaming"] == true if result == false
    result = graphql_object.key?("video") if result == false
    result = check_if_post_is_reel(graphql_object) if result == false
    result
  end

  !result.nil?
end