Initial Tweet object to start querying.
This commit is contained in:
parent
99436b6ebb
commit
c116768ce9
0
Datanalitica.package/Tweet.class/README.md
Normal file
0
Datanalitica.package/Tweet.class/README.md
Normal file
3
Datanalitica.package/Tweet.class/instance/created.st
Normal file
3
Datanalitica.package/Tweet.class/instance/created.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
created
|
||||||
|
^ created
|
@ -0,0 +1,7 @@
|
|||||||
|
accessing
|
||||||
|
fromDictionary: aDictionary
|
||||||
|
created := (aDictionary at: 'created_at') asDateAndTime.
|
||||||
|
text := aDictionary at: 'text'.
|
||||||
|
id := aDictionary at: 'id'.
|
||||||
|
authorId := aDictionary at: 'author_id'.
|
||||||
|
^ self
|
3
Datanalitica.package/Tweet.class/instance/mentions..st
Normal file
3
Datanalitica.package/Tweet.class/instance/mentions..st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
queries
|
||||||
|
mentions: aWord
|
||||||
|
^ self text includesSubstring: aWord
|
5
Datanalitica.package/Tweet.class/instance/printOn..st
Normal file
5
Datanalitica.package/Tweet.class/instance/printOn..st
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
accessing
|
||||||
|
printOn: aStream
|
||||||
|
super printOn: aStream.
|
||||||
|
aStream
|
||||||
|
nextPutAll: '( ',self text ,' )'
|
3
Datanalitica.package/Tweet.class/instance/text.st
Normal file
3
Datanalitica.package/Tweet.class/instance/text.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
text
|
||||||
|
^ text
|
3
Datanalitica.package/Tweet.class/instance/words.st
Normal file
3
Datanalitica.package/Tweet.class/instance/words.st
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
utilities
|
||||||
|
words
|
||||||
|
^ self text splitOn: Character space
|
@ -0,0 +1,3 @@
|
|||||||
|
accessing
|
||||||
|
wordsInLowercase
|
||||||
|
^ self words collect: [:word | word asLowercase ]
|
16
Datanalitica.package/Tweet.class/properties.json
Normal file
16
Datanalitica.package/Tweet.class/properties.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"commentStamp" : "",
|
||||||
|
"super" : "Object",
|
||||||
|
"category" : "Datanalitica",
|
||||||
|
"classinstvars" : [ ],
|
||||||
|
"pools" : [ ],
|
||||||
|
"classvars" : [ ],
|
||||||
|
"instvars" : [
|
||||||
|
"created",
|
||||||
|
"text",
|
||||||
|
"id",
|
||||||
|
"authorId"
|
||||||
|
],
|
||||||
|
"name" : "Tweet",
|
||||||
|
"type" : "normal"
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
accessing
|
|
||||||
userTweetsFor: username
|
|
||||||
| rawResponse queryURL parameters |
|
|
||||||
"The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:"
|
|
||||||
parameters := '?tweet.fields=created_at&expansions=author_id&user.fields=created_at&max_results=100'.
|
|
||||||
queryURL := self usersBaseEndPoint, (self userIDFrom: username), '/tweets', parameters.
|
|
||||||
rawResponse := self rawResponseForURL:queryURL.
|
|
||||||
^ (STONJSON fromString: rawResponse)
|
|
@ -13,6 +13,8 @@ userTweetsFrom: username since: startDateString until: endDateString
|
|||||||
'&', untilDate,
|
'&', untilDate,
|
||||||
'&', nextToken.
|
'&', nextToken.
|
||||||
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
||||||
messages addAll: (response at: 'data').
|
(response at: 'data') do: [:tweetData |
|
||||||
|
messages add: (Tweet new fromDictionary: tweetData)
|
||||||
|
].
|
||||||
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
||||||
^ messages.
|
^ messages.
|
Loading…
Reference in New Issue
Block a user