scraperd 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/lib/scraperd/activity.rb +12 -1
- data/lib/scraperd/version.rb +1 -1
- data/test/activity_test.rb +3 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c8ef633ae60393ebfd3fa5d149953575975d43a
|
4
|
+
data.tar.gz: 91330eff4e4289d8b90411ad6742072e6f1a200d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 272f8ac102e1b632153a0d735fcd9641e0acbfb84285e630486bec1194109484ba873f5614c4292d36bec30790514de2ef01265b5c5b83db4f880646999d0244
|
7
|
+
data.tar.gz: 51ca1921d90f058a112e75bf276ce3b263e3f64ddcd2c6af32b3ee68c75bffe8d1964339e0c5072f767f45fa6b1816c35400a3b5e50d33433135ea5f14858301
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Scraperd
|
2
2
|
|
3
|
-
Scraperd is a very simple scraper for the public user activity RSS in [Letterboxd](http://letterboxd.com). It relies
|
3
|
+
Scraperd is a very simple scraper for the public user activity RSS in [Letterboxd](http://letterboxd.com). It relies on OpenStruct to build objects.
|
4
4
|
|
5
5
|
|
6
6
|
## Installation
|
data/lib/scraperd/activity.rb
CHANGED
@@ -9,6 +9,7 @@ module Scraperd
|
|
9
9
|
super(Hashie::Mash.new({
|
10
10
|
id: item[:guid].force_encoding("UTF-8"),
|
11
11
|
title: title_from_title(item[:title]),
|
12
|
+
year: year_from_title(item[:title]),
|
12
13
|
score: score_from_title(item[:title]),
|
13
14
|
link: item[:link].force_encoding("UTF-8"),
|
14
15
|
film_link: "http://letterboxd.com/film/#{nicetitle_from_url(item[:link])}/".force_encoding("UTF-8"),
|
@@ -28,7 +29,17 @@ module Scraperd
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def title_from_title(title)
|
31
|
-
title.split(' - ')[0..-2].join(' - ')
|
32
|
+
title.split(' - ')[0..-2].join(' - ')
|
33
|
+
.split(',')[0..-2].join(',')
|
34
|
+
.strip
|
35
|
+
.force_encoding("UTF-8")
|
36
|
+
end
|
37
|
+
|
38
|
+
def year_from_title(title)
|
39
|
+
title.split(' - ')[0..-2].join(' - ')
|
40
|
+
.split(',').last
|
41
|
+
.strip
|
42
|
+
.force_encoding("UTF-8")
|
32
43
|
end
|
33
44
|
|
34
45
|
def score_from_title(title)
|
data/lib/scraperd/version.rb
CHANGED
data/test/activity_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class ActivityTest < MiniTest::
|
3
|
+
class ActivityTest < MiniTest::Test
|
4
4
|
def test_activity_conversion
|
5
5
|
item = { :title => "Nausica\xC3\xA4 of the Valley of the Wind, 1984 - \xE2\x98\x85\xE2\x98\x85\xE2\x98\x85\xC2\xBD",
|
6
6
|
:link => "http://letterboxd.com/eltercero/film/nausicaa-of-the-valley-of-the-wind/",
|
@@ -11,7 +11,8 @@ class ActivityTest < MiniTest::Unit::TestCase
|
|
11
11
|
|
12
12
|
activity = Scraperd::Activity.new(item)
|
13
13
|
|
14
|
-
assert_equal activity.title, "Nausica\xC3\xA4 of the Valley of the Wind
|
14
|
+
assert_equal activity.title, "Nausica\xC3\xA4 of the Valley of the Wind"
|
15
|
+
assert_equal activity.year, "1984"
|
15
16
|
assert_equal activity.score, 7
|
16
17
|
assert_equal activity.link, "http://letterboxd.com/eltercero/film/nausicaa-of-the-valley-of-the-wind/"
|
17
18
|
assert_equal activity.film_link, "http://letterboxd.com/film/nausicaa-of-the-valley-of-the-wind/"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scraperd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Víctor Martín
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,7 @@ extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
|
+
- ".travis.yml"
|
97
98
|
- Gemfile
|
98
99
|
- LICENSE.txt
|
99
100
|
- README.md
|