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 +4 -4
- data/lib/facebook_scrapper/scrapper.rb +13 -3
- data/lib/facebook_scrapper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4862ec415a1092035a6806c55ccd7529fa9acc67c3c6840a51dd8efd2b3743
|
4
|
+
data.tar.gz: 705ae2e7b4c1d2af28b8f89e7a373adee1013f1a8044cdf8aca92495202579f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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) }
|