Skip to content

Commit

Permalink
Merge pull request #198 from joaocv3/fix-vimeo-specs
Browse files Browse the repository at this point in the history
Fix vimeo specs
  • Loading branch information
thibaudgg committed Sep 28, 2020
2 parents 67e76e0 + 81a3aa1 commit eba0e8c
Show file tree
Hide file tree
Showing 77 changed files with 4,199 additions and 3,743 deletions.
12 changes: 11 additions & 1 deletion lib/video_info/providers/vimeo_scraper.rb
Expand Up @@ -122,12 +122,22 @@ def thumbnail_large

def view_count
if available?
json_info['interactionCount']
user_interaction_count(interaction_type: "http://schema.org/WatchAction")
end
end

private

def user_interaction_count(interaction_type:)
interaction_statistic.find do |stat|
stat["interactionType"] == interaction_type
end["userInteractionCount"]
end

def interaction_statistic
json_info["interactionStatistic"]
end

def json_info
@json_info ||= JSON.parse(data.css('script').detect do |n|
type = n.attr('type')
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eba0e8c

Please sign in to comment.