Skip to content

Commit

Permalink
Merge pull request #61 from Fullscreen/funky-metrics-216
Browse files Browse the repository at this point in the history
Funky metrics 216
  • Loading branch information
claudiofullscreen committed Dec 12, 2016
2 parents 752a779 + 924a232 commit 30c07fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,10 @@ For more information about changelogs, check
[Keep a Changelog](http://keepachangelog.com) and
[Vandamme](http://tech-angels.github.io/vandamme).

## 0.2.8 - 2016/12/12

* [BUGFIX] Change the way that "like counts" are parsed now that Facebook has changed the structure of the HTML and can include multiple "likecounts" elements in the same page.

## 0.2.7 - 2016/08/18

* [ENHANCEMENT] When Funky makes a request to an HTML page, Funky would now raise `Funky::ConnectionError` should the following errors occur:
Expand Down
2 changes: 1 addition & 1 deletion lib/funky/html/parser.rb
Expand Up @@ -23,7 +23,7 @@ def extract_views_from(html)
end

def extract_likes_from(html)
html.match /"likecount":(.*?),/
html.match(/"likecount":(\d+),"likecountreduced"/)
matched_count $1
end

Expand Down
2 changes: 1 addition & 1 deletion lib/funky/version.rb
@@ -1,3 +1,3 @@
module Funky
VERSION = "0.2.7"
VERSION = "0.2.8"
end
6 changes: 6 additions & 0 deletions spec/videos/video_spec.rb
Expand Up @@ -61,6 +61,12 @@
include_examples 'check id and counters'
end

context 'given an existing video ID of a video with more than 800 likes was passed' do
let(:video_id) { existing_video_id }

it { expect(video.like_count).to be > 800 }
end

context 'given a non-existing video ID was passed' do
let(:video_id) { unknown_video_id }

Expand Down

0 comments on commit 30c07fc

Please sign in to comment.