twittercrawler 0.0.8 → 0.0.9

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/twitter_parser.rb +22 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7adc5f95dab15d0c4266e6a6a99fcbaaadf1abe
4
- data.tar.gz: 404455f84720f4a4d219094a545f722103618856
3
+ metadata.gz: bd66392453ee594f240aba2f3e958c171e516adf
4
+ data.tar.gz: 66d6b2afd3da543cf76c1cc0db0e68a3d81d63b7
5
5
  SHA512:
6
- metadata.gz: a1b34d3e27e37eb8f9cc205a15da824dd3d035755eb33bdfdac5344424bd8e96d42ee751c77ad8164bbee2292f88c095710d632f85ac7f253b5b6c784ae121bf
7
- data.tar.gz: 11bf96af63b7d233e7c8f126fe046d75f43d122f01bbb6b86762811ce8960c57c3ef246085f3f67b58d693292927c92268023b7a219d69f7920b0622b40b1873
6
+ metadata.gz: 7f55deb6274e2b9cd4f937330883e7c0cc45755205781bc5ac36753893b29ee68bafbb4cf348cb08f0d85cb6c7a8d86168f06083a9e7d19b79379825b5071aa6
7
+ data.tar.gz: 1bb607b0c4442a727f03d350cfce0d37b477598cb731e9fe6170f32dd13ad8e7ed664cdb61f10243044b296b7eb36ba952635a895b83abd9a4fa89f0348ddb1a
@@ -1,7 +1,9 @@
1
1
  require 'nokogiri'
2
2
  require 'pry'
3
+ require 'twitter-text'
3
4
 
4
5
  class TwitterParser
6
+ include Twitter::Extractor
5
7
  def initialize(tweet)
6
8
  @tweet = Nokogiri::HTML.parse(tweet)
7
9
  end
@@ -14,6 +16,9 @@ class TwitterParser
14
16
  username: get_username,
15
17
  fullname: get_fullname,
16
18
  user_id: get_user_id,
19
+ profile_pic: get_profile_pic,
20
+ hashtags: get_hashtags,
21
+ mentioned_urls: get_mentioned_urls,
17
22
  reply_to_user: get_reply_to_user[0],
18
23
  reply_to_uid: get_reply_to_user[1],
19
24
  tweet_time: get_tweet_time,
@@ -29,6 +34,23 @@ class TwitterParser
29
34
  end
30
35
  end
31
36
 
37
+ # Get the link to the profile pic
38
+ def get_profile_pic
39
+ @tweet.css("img.avatar")[0]['src']
40
+ end
41
+
42
+ # Get the URLS in the tweet
43
+ def get_mentioned_urls
44
+ tweet = get_tweet_text
45
+ return extract_urls(tweet)
46
+ end
47
+
48
+ # Get the hashtags in the tweet
49
+ def get_hashtags
50
+ tweet = get_tweet_text
51
+ return extract_hashtags(tweet)
52
+ end
53
+
32
54
  # Get the username
33
55
  def get_username
34
56
  @tweet.css(".username").text
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twittercrawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. C. McGrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Crawls Twitter
14
14
  email: shidash@shidash.com