plagiarism2 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/lib/plagiarism/strategries/bing.rb +2 -2
- data/lib/plagiarism/strategries/duck.rb +3 -3
- data/lib/plagiarism/strategries/engine.rb +2 -2
- data/lib/plagiarism/strategries/free_google.rb +2 -2
- data/lib/plagiarism/strategries/google.rb +2 -2
- data/lib/plagiarism/strategries/yahoo.rb +4 -4
- data/lib/plagiarism/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f4e43615c24c041d05466d83091b775a26bcde1
|
4
|
+
data.tar.gz: 2fc69b5c28c9a5da3726765071fc21323bc80ac3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f97108d3ff54b682628ae1328f67726871761cd2121aace55debb7784cdbd5fe21b6d4c7e1661562ed30853bf0afba3397540d3c3e8d62bdd89f2f5dd315841
|
7
|
+
data.tar.gz: e4e2014486db66aecb23159296c1e03578542e2b1ce3b13a8bbbcf883967640335588e476882d2f1fcf4a67fcbd2649eb73e31b94d7233c90039633cde942904
|
data/README.md
CHANGED
@@ -44,20 +44,27 @@ config.google_key = xxx
|
|
44
44
|
config.google_cx = xx
|
45
45
|
```
|
46
46
|
|
47
|
-
|
47
|
+
###### Plagiarism.unique?
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
text = 'Latte user story paradigm affordances experiential innovate venture capital physical computing. Ship it agile actionable insight iterate thought leader pitch deck experiential iterate. Venture capital food-truck quantitative vs. qualitative SpaceTeam convergence agile.'
|
51
|
-
Plagiarism.unique? text
|
51
|
+
Plagiarism.unique? text # => true
|
52
52
|
```
|
53
53
|
|
54
54
|
`Plagiarism.unique?` is true when all strategies is true
|
55
55
|
|
56
|
+
###### Plagiarism.match
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Plagiarism.match 'ringmd' # => 'www.ring.md'
|
60
|
+
```
|
61
|
+
|
56
62
|
#### Bash
|
57
63
|
|
58
64
|
```bash
|
59
|
-
plagiarism init # generate config
|
60
|
-
plagiarism unique -c="ringmd" #
|
65
|
+
plagiarism init # generate config, default ~/.plagiarism.yml
|
66
|
+
plagiarism unique -c="ringmd" # => false
|
67
|
+
plagiarism match -c="ringmd" # => 'www.ring.md'
|
61
68
|
```
|
62
69
|
|
63
70
|
For more details, you can use help
|
@@ -9,9 +9,9 @@ module Plagiarism
|
|
9
9
|
Typhoeus.get(URL, params: params.merge('$format' => :json, 'Query' => "'#{content}'"), userpwd: ":#{Config.bing_key}")
|
10
10
|
end
|
11
11
|
|
12
|
-
def iterate(response)
|
12
|
+
def iterate(response, action = :all?)
|
13
13
|
results = JSON.parse(response)['d']['results'] rescue []
|
14
|
-
results.
|
14
|
+
results.send(action) do |r|
|
15
15
|
uri = URI.parse URI::encode(r['Url'])
|
16
16
|
yield uri
|
17
17
|
end
|
@@ -9,10 +9,10 @@ module Plagiarism
|
|
9
9
|
Typhoeus.get(URL, params: params.merge(q: content))
|
10
10
|
end
|
11
11
|
|
12
|
-
def iterate(response)
|
12
|
+
def iterate(response, action = :all?)
|
13
13
|
doc = Nokogiri::HTML response
|
14
|
-
doc.css('.results_links_deep:not(.result--no-result)').
|
15
|
-
href = row.
|
14
|
+
doc.css('.results_links_deep:not(.result--no-result) .result__a').send(action) do |row|
|
15
|
+
href = row.attributes['href'].value rescue ''
|
16
16
|
uri = URI.parse URI::encode(href)
|
17
17
|
yield uri
|
18
18
|
end
|
@@ -10,7 +10,7 @@ module Plagiarism
|
|
10
10
|
raise
|
11
11
|
end
|
12
12
|
|
13
|
-
def iterate(r)
|
13
|
+
def iterate(r, a = :all?)
|
14
14
|
raise
|
15
15
|
end
|
16
16
|
|
@@ -51,7 +51,7 @@ module Plagiarism
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def retrieve_link(response)
|
54
|
-
self.class.iterate(response) { |uri| uri.host !~ self.class.whitelists_regex and return uri.to_s }
|
54
|
+
self.class.iterate(response, :find) { |uri| uri.host !~ self.class.whitelists_regex and return uri.to_s }
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -10,9 +10,9 @@ module Plagiarism
|
|
10
10
|
Typhoeus.get URL, params: params.merge(v: VERSION, q: content, rsz: :large)
|
11
11
|
end
|
12
12
|
|
13
|
-
def iterate(response)
|
13
|
+
def iterate(response, action = :all?)
|
14
14
|
results = JSON.parse(response)['responseData']['results'] rescue []
|
15
|
-
results.
|
15
|
+
results.send(action) do |r|
|
16
16
|
uri = URI.parse URI::encode(r['unescapedUrl'])
|
17
17
|
yield uri
|
18
18
|
end
|
@@ -16,9 +16,9 @@ module Plagiarism
|
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
|
-
def iterate(response)
|
19
|
+
def iterate(response, action = :all?)
|
20
20
|
results = JSON.parse(response)['items'] || []
|
21
|
-
results.
|
21
|
+
results.send(action) do |r|
|
22
22
|
uri = URI.parse URI::encode(r['link'])
|
23
23
|
yield uri
|
24
24
|
end
|
@@ -6,13 +6,13 @@ module Plagiarism
|
|
6
6
|
class << self
|
7
7
|
|
8
8
|
def fetch(content, params)
|
9
|
-
Typhoeus.get(URL, params: params.merge(p: content))
|
9
|
+
Typhoeus.get(URL, params: params.merge(p: content), headers: { 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36' })
|
10
10
|
end
|
11
11
|
|
12
|
-
def iterate(response)
|
12
|
+
def iterate(response, action = :all?)
|
13
13
|
doc = Nokogiri::HTML response
|
14
|
-
doc.css('.searchCenterMiddle li').
|
15
|
-
href = row.
|
14
|
+
doc.css('.searchCenterMiddle li .compTitle a').send(action) do |row|
|
15
|
+
href = row.attributes['href'].value
|
16
16
|
uri = URI.parse URI::encode(href)
|
17
17
|
yield uri
|
18
18
|
end
|
data/lib/plagiarism/version.rb
CHANGED