facebook_scrapper 0.3.1 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ae5a152ebeaf4d374da853bc0cbc0afb86487024781c3f1d6dce439f6cec0b
4
- data.tar.gz: c8907e5ffa25af87b72ab1e1a6e39eddcddbdbb29074d8158e5df59078e10dbb
3
+ metadata.gz: 8b4862ec415a1092035a6806c55ccd7529fa9acc67c3c6840a51dd8efd2b3743
4
+ data.tar.gz: 705ae2e7b4c1d2af28b8f89e7a373adee1013f1a8044cdf8aca92495202579f2
5
5
  SHA512:
6
- metadata.gz: 2dcc8173ad0b67dfadd5b83a7da432c79f02d3d54b1513066ea72b7583e065ae49caef76beaf4423dc0a76d626ff21bac9ff801e282b6bafa9c3363664f364cb
7
- data.tar.gz: de4502f4bf3141a82906c1604bb9f927d756d90a1572932c722ba369f93b6556a354a9926392e5f67c0cb57a3cc832c92c967e815e28d274a4c1a66f0b7db14b
6
+ metadata.gz: 2a69331199e1232c8faae9660faa98fd3c6fc1d2aa69b29677a8ab107d21eaaf50294902368d4c22a1d4c210c9916af5e123c3001913f3e3766c484f834a1af4
7
+ data.tar.gz: c1b6cd4a7d5a2c207a5b56690ba93b54f7a11261c57ed8966ea4e22f7266fde6c7244cde22249c9a9a19c7c565c2fb9156f9818723dc0dcd4d5e861e441ebe2a
@@ -106,6 +106,16 @@ module FacebookScrapper
106
106
  end
107
107
  end
108
108
 
109
+ def toWebUrl(url)
110
+ if url.include? "m.facebook.com"
111
+ return url.gsub!("m.facebook.com", "www.facebook.com")
112
+ elsif url.include? "mbasic.facebook.com"
113
+ return url.gsub!("mbasic.facebook.com", "www.facebook.com")
114
+ else
115
+ return url
116
+ end
117
+ end
118
+
109
119
  def get(url)
110
120
  @driver.get(toBasicUrl(url))
111
121
  end
@@ -131,9 +141,9 @@ module FacebookScrapper
131
141
  post.like_count = all_links[-7 - with_share].text.to_i
132
142
  post.comment_count = all_links[-4 - with_share].text.to_i
133
143
  post.time = new_post.find_element(tag_name: "abbr").text
134
- post.post_owner_link = all_links[0].attribute("href")
135
- post.comment_link = all_links[-4 - with_share].attribute("href")
136
- post.like_link = like_data.find_element(link_text: "Like").attribute("href")
144
+ post.post_owner_link = toWebUrl(all_links[0].attribute("href"))
145
+ post.comment_link = toWebUrl(all_links[-4 - with_share].attribute("href"))
146
+ post.like_link = toWebUrl(like_data.find_element(link_text: "Like").attribute("href"))
137
147
  post.more_link = all_links[-1].attribute("href")
138
148
 
139
149
  keyword_included = keywords.any? { |keyword| post.text.include?(keyword) }
@@ -1,3 +1,3 @@
1
1
  module FacebookScrapper
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook_scrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mujadded Al Rabbani Alif