twitterscraper-ruby 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f04cb0ba394884918271b5485b596c07203b7a6e9f4fec42d074ef4f02b6a0a
4
- data.tar.gz: a4f618df53d1e8b54954619e87d383e43dbe5a63bbf83b33ee38f975998f2678
3
+ metadata.gz: 7f7d320841125d9a582ece6083f421f0abf301addbc5c5c2a3d2b2c09bedbc33
4
+ data.tar.gz: 6ea43165ffa4f37c4319566689a42f2f275d8a70402b0d6b4164df519fee90b5
5
5
  SHA512:
6
- metadata.gz: fa9f02cf3ef0bf280f45b18ebacaec0b06dbd610477355602fcc59d382b5590c990695297e1e793457fdcff4cb7dd037f076c1f0fa4706eb69c67c3a165243e4
7
- data.tar.gz: 9c08d9e4d1ee56fa133675bc73a50f502040cc9a2844d9a46a39c38ccdffdf43c15b17c2e4a8b74561f523493ccbc4a055f0add239574d2f5129ee4abe1f5ed9
6
+ metadata.gz: ee3756538ec28e9f0113e611e2731ec33107dabacf7cb730b257d6c94351407ef171a9bc91402a589fa73fdb6b705f73b11582766af1d04a3413b8bc79dc6619
7
+ data.tar.gz: 78200dc658a9c1cf43ed7367e499b0d1b243728aecb2ffd7366b5612f8905bb33d27ab7e1412327d05b7fff159196fe9e24d18c8cc4c24898af10533fbdf43df
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitterscraper-ruby (0.15.1)
4
+ twitterscraper-ruby (0.15.2)
5
5
  nokogiri
6
6
  parallel
7
7
 
@@ -4,6 +4,7 @@ require 'twitterscraper/http'
4
4
  require 'twitterscraper/lang'
5
5
  require 'twitterscraper/cache'
6
6
  require 'twitterscraper/query'
7
+ require 'twitterscraper/type'
7
8
  require 'twitterscraper/client'
8
9
  require 'twitterscraper/tweet'
9
10
  require 'twitterscraper/template'
@@ -28,7 +28,7 @@ module Twitterscraper
28
28
  'max_position=__POS__&reset_error_state=false'
29
29
 
30
30
  def build_query_url(query, lang, type, pos)
31
- if type == 'user'
31
+ if type.user?
32
32
  if pos
33
33
  RELOAD_URL_USER.sub('__USER__', query).sub('__POS__', pos.to_s)
34
34
  else
@@ -108,7 +108,7 @@ module Twitterscraper
108
108
 
109
109
  if json_resp
110
110
  [tweets, json_resp['min_position']]
111
- elsif type
111
+ elsif type.user?
112
112
  [tweets, tweets[-1].tweet_id]
113
113
  else
114
114
  [tweets, "TWEET-#{tweets[-1].tweet_id}-#{tweets[0].tweet_id}"]
@@ -200,6 +200,7 @@ module Twitterscraper
200
200
  start_date = Date.parse(start_date) if start_date && start_date.is_a?(String)
201
201
  end_date = Date.parse(end_date) if end_date && end_date.is_a?(String)
202
202
  queries = build_queries(query, start_date, end_date)
203
+ type = Type.new(type)
203
204
  if threads > queries.size
204
205
  logger.warn 'The maximum number of :threads is the number of dates between :start_date and :end_date.'
205
206
  threads = queries.size
@@ -0,0 +1,15 @@
1
+ module Twitterscraper
2
+ class Type
3
+ def initialize(value)
4
+ @value = value
5
+ end
6
+
7
+ def search?
8
+ @value == 'search'
9
+ end
10
+
11
+ def user?
12
+ @value == 'user'
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Twitterscraper
2
- VERSION = '0.15.1'
2
+ VERSION = '0.15.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitterscraper-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ts-3156
@@ -73,6 +73,7 @@ files:
73
73
  - lib/twitterscraper/query.rb
74
74
  - lib/twitterscraper/template.rb
75
75
  - lib/twitterscraper/tweet.rb
76
+ - lib/twitterscraper/type.rb
76
77
  - lib/version.rb
77
78
  - twitterscraper-ruby.gemspec
78
79
  homepage: https://github.com/ts-3156/twitterscraper-ruby