Removing BaselineOfDatanalitica and Datanalitica.
This commit is contained in:
parent
f323c51d2a
commit
e5e8fea29d
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"separateMethodMetaAndSource" : false,
|
|
||||||
"noMethodMetaData" : true,
|
|
||||||
"useCypressPropertiesFile" : true
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
baselines
|
|
||||||
baseline: spec
|
|
||||||
<baseline>
|
|
||||||
spec
|
|
||||||
for: #common
|
|
||||||
do: [
|
|
||||||
"Dependencies"
|
|
||||||
self xmlParserHTML: spec.
|
|
||||||
"self rssTools: spec."
|
|
||||||
"Packages"
|
|
||||||
spec
|
|
||||||
package: 'Socialmetrica'
|
|
||||||
with: [ spec requires: #('XMLParserHTML' "'RSSTools'") ]
|
|
||||||
]
|
|
@ -1,10 +0,0 @@
|
|||||||
baselines
|
|
||||||
rssTools: spec
|
|
||||||
Metacello new
|
|
||||||
repository: 'github://brackendev/RSSTools-Pharo:v1.0.1/src';
|
|
||||||
baseline: 'RSSTools';
|
|
||||||
onConflict: [ :ex | ex useLoaded ];
|
|
||||||
onUpgrade: [ :ex | ex useLoaded ];
|
|
||||||
onDowngrade: [ :ex | ex useLoaded ];
|
|
||||||
load.
|
|
||||||
spec baseline: 'RSSTools' with: [ spec repository: 'github://brackendev/RSSTools-Pharo:v1.0.1/src']
|
|
@ -1,11 +0,0 @@
|
|||||||
baselines
|
|
||||||
xmlParserHTML: spec
|
|
||||||
Metacello new
|
|
||||||
baseline: 'XMLParserHTML';
|
|
||||||
repository: 'github://pharo-contributions/XML-XMLParserHTML/src';
|
|
||||||
onConflict: [ :ex | ex useLoaded ];
|
|
||||||
onUpgrade: [ :ex | ex useLoaded ];
|
|
||||||
onDowngrade: [ :ex | ex useLoaded ];
|
|
||||||
onWarningLog;
|
|
||||||
load.
|
|
||||||
spec baseline: 'XMLParserHTML' with: [spec repository: 'github://pharo-contributions/XML-XMLParserHTML/src']
|
|
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "",
|
|
||||||
"super" : "BaselineOf",
|
|
||||||
"category" : "BaselineOfDatanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [ ],
|
|
||||||
"name" : "BaselineOfSocialmetrica",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
SystemOrganization addCategory: #BaselineOfDatanalitica!
|
|
@ -1 +0,0 @@
|
|||||||
(name 'BaselineOfDatanalitica')
|
|
@ -1 +0,0 @@
|
|||||||
{ }
|
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"separateMethodMetaAndSource" : false,
|
|
||||||
"noMethodMetaData" : true,
|
|
||||||
"useCypressPropertiesFile" : true
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
addKeyword: keyword to: subtopic
|
|
||||||
(self subtopics at: subtopic) add: keyword.
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
addSubtopic: subtopicString
|
|
||||||
self subtopics at: subtopicString put: Set new.
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
language: isoLanguageCode
|
|
||||||
"isoLanguageCode follows the ISO 639-1 two letters convention"
|
|
||||||
language := isoLanguageCode
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
language
|
|
||||||
^ language
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
name: aString
|
|
||||||
name := aString
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
name
|
|
||||||
^ name
|
|
@ -1,5 +0,0 @@
|
|||||||
accessing
|
|
||||||
printOn: aStream
|
|
||||||
super printOn: aStream.
|
|
||||||
aStream
|
|
||||||
nextPutAll: '( ',self name, ' | ', self language, ' )'
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
subtopics: subtopicsNamesArray
|
|
||||||
subtopicsNamesArray do: [:each | self addSubtopic: each ]
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
subtopics
|
|
||||||
^ subtopics ifNil: [ subtopics := Dictionary new ]
|
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "",
|
|
||||||
"super" : "Object",
|
|
||||||
"category" : "Datanalitica-Datanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [
|
|
||||||
"language",
|
|
||||||
"name",
|
|
||||||
"subtopics"
|
|
||||||
],
|
|
||||||
"name" : "DiscourseTopic",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
accessing
|
|
||||||
nitterProvider
|
|
||||||
"For a full list of Nitter providers, see:
|
|
||||||
|
|
||||||
https://github.com/zedeus/nitter/wiki/Instances"
|
|
||||||
^ 'https://nitter.42l.fr/'
|
|
@ -1,7 +0,0 @@
|
|||||||
accessing
|
|
||||||
asDictionary
|
|
||||||
|
|
||||||
^ { 'profile-card-avatar' -> self profileImageFile fullName.
|
|
||||||
'profile-card-fullname' -> self name .
|
|
||||||
'profile-card-username' -> self userName .
|
|
||||||
'profile-bio' -> self profileBio } asDictionary
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
config: aDictionary
|
|
||||||
|
|
||||||
config := aDictionary
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
config
|
|
||||||
|
|
||||||
^ config
|
|
@ -1,6 +0,0 @@
|
|||||||
accessing
|
|
||||||
createdAt
|
|
||||||
^ createdAt ifNil: [| joinDateString |
|
|
||||||
joinDateString := ((self documentTree xpath: '//div[@class="profile-joindate"]/span/@title') stringValue).
|
|
||||||
createdAt := (ZTimestampFormat fromString:'4:05 PM - 03 Feb 2001') parse: joinDateString.
|
|
||||||
]
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
description
|
|
||||||
^ description ifNil: [description := (self documentTree xpath: '//div[@class="profile-bio"]') stringValue]
|
|
@ -1,3 +0,0 @@
|
|||||||
operation
|
|
||||||
documentTree
|
|
||||||
^ XMLHTMLParser parse: self userNameLink asUrl retrieveContents
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
downloadProfileImage
|
|
||||||
|
|
||||||
^ self exportProfileImageOn: self folder / self userName, 'jpg'
|
|
@ -1,11 +0,0 @@
|
|||||||
accessing
|
|
||||||
exportProfileImageOn: fileReference
|
|
||||||
|
|
||||||
| file |
|
|
||||||
file := fileReference asFileReference.
|
|
||||||
file ensureDelete.
|
|
||||||
file exists ifFalse: [ file ensureCreateFile ].
|
|
||||||
file binaryWriteStreamDo: [ :stream |
|
|
||||||
stream nextPutAll: profileImageUrl retrieveContents ].
|
|
||||||
super class inform: 'Exported as: ', String cr, file fullName.
|
|
||||||
^ file
|
|
@ -1,7 +0,0 @@
|
|||||||
accessing
|
|
||||||
exportWithTemplate: mustacheFile On: folder
|
|
||||||
|
|
||||||
MarkupFile
|
|
||||||
exportAsFileOn: (folder / self userName , 'tex')
|
|
||||||
containing:(mustacheFile asMustacheTemplate value:
|
|
||||||
self asDictionary)
|
|
@ -1,21 +0,0 @@
|
|||||||
accessing
|
|
||||||
externalWordCloud
|
|
||||||
|
|
||||||
| text outputFile |
|
|
||||||
outputFile := (self folder / 'nube.png')fullName.
|
|
||||||
text := (self folder / 'texto.txt')fullName.
|
|
||||||
OSSUnixSubprocess new
|
|
||||||
command: 'wordcloud_cli';
|
|
||||||
arguments: { '--text' . text .
|
|
||||||
'--imagefile' . outputFile .
|
|
||||||
'--color' . '#5B83DE' .
|
|
||||||
'--width' . '1153' .
|
|
||||||
'--height' . '357' .
|
|
||||||
'--background' . 'white' .
|
|
||||||
'--mode' . 'RGBA' .
|
|
||||||
'--stopwords' . 'stopwords-es.txt' .
|
|
||||||
'--mask' . '../commons/nube-mascara.jpg'};
|
|
||||||
workingDirectory: self folder fullName;
|
|
||||||
redirectStdout;
|
|
||||||
redirectStderr;
|
|
||||||
runAndWaitOnExitDo: [ :process :outString | ^ outputFile asFileReference ]
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
folder
|
|
||||||
|
|
||||||
^ self config at: 'folder'.
|
|
@ -1,10 +0,0 @@
|
|||||||
accessing
|
|
||||||
getMessages
|
|
||||||
| lastTweetsRaw lastTweets |
|
|
||||||
lastTweetsRaw := self rssFeed xmlDocument xpath: '//item'.
|
|
||||||
lastTweets := TweetsCollection new.
|
|
||||||
lastTweetsRaw do: [ :rssTweet |
|
|
||||||
lastTweets add: ((Tweet new fromNitterRssItem: rssTweet ))
|
|
||||||
].
|
|
||||||
^ lastTweets
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
id
|
|
||||||
^ id ifNil: [id := (self profileImageUrl segments select: [ :each | each asInteger class = LargePositiveInteger]) first.]
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
name
|
|
||||||
^ name ifNil: [ name := ((self rssFeed requiredItems title) splitOn: '/') first ]
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
profileBio
|
|
||||||
|
|
||||||
^ profileBio ifNil: [ profileBio := (self documentTree xpath: '/html/body/div/div/div[2]/div[1]/div[2]/div[1]') stringValue]
|
|
@ -1,7 +0,0 @@
|
|||||||
accessing
|
|
||||||
profileImageFile
|
|
||||||
|
|
||||||
| file |
|
|
||||||
file := (self folder / self userName, 'jpg').
|
|
||||||
file exists ifTrue: [ ^ file ].
|
|
||||||
^ self downloadProfileImage
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
profileImageUrl
|
|
||||||
^ profileImageUrl ifNil: [
|
|
||||||
profileImageUrl := ((self rssFeed xmlDocument xpath: '//image/url') stringValue copyReplaceAll: '%2F' with: '/') asUrl ]
|
|
@ -1,12 +0,0 @@
|
|||||||
accessing
|
|
||||||
retrieveContents
|
|
||||||
self userName ifNil: [^ self].
|
|
||||||
^ self
|
|
||||||
id;
|
|
||||||
name;
|
|
||||||
description;
|
|
||||||
createdAt;
|
|
||||||
url;
|
|
||||||
profileImageUrl;
|
|
||||||
profileBio;
|
|
||||||
yourself.
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
rssFeed
|
|
||||||
|
|
||||||
^ RSSTools createRSSFeedFor: self userNameLink , '/rss'
|
|
@ -1,7 +0,0 @@
|
|||||||
accessing
|
|
||||||
url
|
|
||||||
^ url ifNil: [ | temp |
|
|
||||||
temp := ((self documentTree xpath: '//div[@class="profile-website"]') // 'a' @@ 'href') first.
|
|
||||||
temp ifNil: [ ^ url := nil ].
|
|
||||||
url := temp asUrl.
|
|
||||||
]
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
userName: userNameString
|
|
||||||
userName := userNameString.
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
userNameLink
|
|
||||||
|
|
||||||
^ self class nitterProvider, self userName
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "",
|
|
||||||
"super" : "TwitterUser",
|
|
||||||
"category" : "Datanalitica-Datanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [
|
|
||||||
"config"
|
|
||||||
],
|
|
||||||
"name" : "NitterUser",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
accessing
|
|
||||||
asCardElement
|
|
||||||
| aModeLook anEditor textInfoPane buttonsPane |
|
|
||||||
|
|
||||||
aModeLook := BrEditorModeAptitude new
|
|
||||||
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
|
|
||||||
editableUnfocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors editorBorderColor width: 1) ];
|
|
||||||
readOnly: [ :aWidget | aWidget border: BlBorder empty ].
|
|
||||||
|
|
||||||
anEditor := BrEditor new
|
|
||||||
aptitude: BrGlamorousRegularEditorAptitude new + aModeLook;
|
|
||||||
text: self text;
|
|
||||||
vFitContent.
|
|
||||||
|
|
||||||
textInfoPane := BrVerticalPane new
|
|
||||||
hMatchParent;
|
|
||||||
vFitContent;
|
|
||||||
margin: (BlInsets left: 20);
|
|
||||||
addChild: (BrLabel new
|
|
||||||
aptitude: BrGlamorousLabelAptitude;
|
|
||||||
text: '@' , self user userName , ' | ' , self created asString;
|
|
||||||
beSmallSize);
|
|
||||||
addChild: anEditor.
|
|
||||||
buttonsPane := BrHorizontalPane new
|
|
||||||
fitContent;
|
|
||||||
cellSpacing: 5;
|
|
||||||
addChildren: {
|
|
||||||
BrButton new
|
|
||||||
aptitude: BrGlamorousButtonWithLabelAptitude new;
|
|
||||||
label: 'Toggle subtopics';
|
|
||||||
action: [ anEditor beEditable ].
|
|
||||||
BrButton new
|
|
||||||
aptitude: BrGlamorousButtonWithLabelAptitude new;
|
|
||||||
label: 'Add subtopic keyword';
|
|
||||||
action: [ anEditor beReadOnlyWithSelection ].
|
|
||||||
BrButton new
|
|
||||||
aptitude: BrGlamorousButtonWithLabelAptitude new;
|
|
||||||
label: 'Details';
|
|
||||||
action: [ :e | e phlow spawnObject: self ].
|
|
||||||
BrButton new
|
|
||||||
aptitude: BrGlamorousButtonWithLabelAptitude new;
|
|
||||||
label: 'Web view';
|
|
||||||
action: [ self webView ].
|
|
||||||
}.
|
|
||||||
|
|
||||||
^ BrHorizontalPane new
|
|
||||||
padding: (BlInsets all: 15);
|
|
||||||
margin: (BlInsets all: 10);
|
|
||||||
cellSpacing: 5;
|
|
||||||
hMatchParent;
|
|
||||||
vFitContent;
|
|
||||||
addChildren: {
|
|
||||||
(self user profileImage asElement asScalableElement size: 64 @ 64).
|
|
||||||
BrVerticalPane new
|
|
||||||
cellSpacing: 5;
|
|
||||||
hMatchParent;
|
|
||||||
vFitContent;
|
|
||||||
addChildren: {
|
|
||||||
buttonsPane.
|
|
||||||
textInfoPane.
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
created
|
|
||||||
^ created
|
|
@ -1,9 +0,0 @@
|
|||||||
accessing
|
|
||||||
fromDictionary: aDictionary
|
|
||||||
created := (aDictionary at: 'created_at') asDateAndTime.
|
|
||||||
text := aDictionary at: 'text'.
|
|
||||||
id := aDictionary at: 'id'.
|
|
||||||
authorId := aDictionary at: 'author_id'.
|
|
||||||
user := aDictionary at: 'username' ifAbsent: [''] .
|
|
||||||
conversationId := aDictionary at: 'conversation_id' ifAbsent: [ '' ].
|
|
||||||
^ self
|
|
@ -1,9 +0,0 @@
|
|||||||
accessing
|
|
||||||
fromNitter: aDictionary
|
|
||||||
created := (aDictionary at: 'pubDate') "asDateAndTime".
|
|
||||||
text := aDictionary at: 'text'.
|
|
||||||
"id := aDictionary at: 'id'.
|
|
||||||
authorId := aDictionary at: 'author_id'."
|
|
||||||
user := aDictionary at: 'creator'.
|
|
||||||
"conversationId := aDictionary at: 'conversation_id' ifAbsent: [ '' ]."
|
|
||||||
^ self
|
|
@ -1,9 +0,0 @@
|
|||||||
accessing
|
|
||||||
fromNitterRssItem: xmlItem
|
|
||||||
| author |
|
|
||||||
author := (xmlItem xpath: 'dc:creator') stringValue allButFirst.
|
|
||||||
user := NitterUser new
|
|
||||||
userName: author .
|
|
||||||
created := (xmlItem xpath: 'pubDate') stringValue.
|
|
||||||
text := (XMLHTMLParser on: (xmlItem xpath: 'description') stringValue) parseDocument stringValue.
|
|
||||||
id := ((xmlItem xpath: 'guid') stringValue splitOn: '/') last copyReplaceAll: '#m' with: ''
|
|
@ -1,16 +0,0 @@
|
|||||||
accessing
|
|
||||||
gtViewTweetDetailsOn: aView
|
|
||||||
<gtView>
|
|
||||||
^ aView explicit
|
|
||||||
title: 'Tweet Details' translated;
|
|
||||||
priority: 5;
|
|
||||||
stencil: [
|
|
||||||
BlElement new
|
|
||||||
layout: BlFlowLayout new;
|
|
||||||
constraintsDo: [ :c |
|
|
||||||
c vertical fitContent.
|
|
||||||
c horizontal matchParent ];
|
|
||||||
padding: (BlInsets all: 10);
|
|
||||||
addChild: (self asCardElement margin: (BlInsets all: 20))
|
|
||||||
]
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
id
|
|
||||||
^ id
|
|
@ -1,3 +0,0 @@
|
|||||||
queries
|
|
||||||
mentions: aWord
|
|
||||||
^ self text includesSubstring: aWord
|
|
@ -1,5 +0,0 @@
|
|||||||
accessing
|
|
||||||
printOn: aStream
|
|
||||||
super printOn: aStream.
|
|
||||||
aStream
|
|
||||||
nextPutAll: '( ',self text ,' )'
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
text
|
|
||||||
^ text
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
user: aTwitterUser
|
|
||||||
user := aTwitterUser
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
user
|
|
||||||
^ user
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
webView
|
|
||||||
WebBrowser openOn: 'https://twitter.com/', self user userName, '/status/', self id
|
|
@ -1,3 +0,0 @@
|
|||||||
utilities
|
|
||||||
words
|
|
||||||
^ self text allRegexMatches: '\w*'
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
wordsInLowercase
|
|
||||||
^ self words collect: [:word | word asLowercase ]
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "",
|
|
||||||
"super" : "Object",
|
|
||||||
"category" : "Datanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [
|
|
||||||
"created",
|
|
||||||
"text",
|
|
||||||
"id",
|
|
||||||
"authorId",
|
|
||||||
"conversationId",
|
|
||||||
"user"
|
|
||||||
],
|
|
||||||
"name" : "Tweet",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
add: aTweet
|
|
||||||
self tweets add: aTweet
|
|
@ -1,25 +0,0 @@
|
|||||||
ui
|
|
||||||
gtTweetsFor: aView
|
|
||||||
<gtView>
|
|
||||||
^ aView explicit
|
|
||||||
title: 'Tweets';
|
|
||||||
stencil: [
|
|
||||||
| container imageContainer |
|
|
||||||
container := BlElement new
|
|
||||||
layout: BlFlowLayout new;
|
|
||||||
constraintsDo: [ :c |
|
|
||||||
c vertical fitContent.
|
|
||||||
c horizontal matchParent ];
|
|
||||||
padding: (BlInsets all: 10).
|
|
||||||
self tweets do: [ :each |
|
|
||||||
imageContainer := BlLazyElement new
|
|
||||||
withGlamorousPreview;
|
|
||||||
aptitude: BrShadowAptitude new;
|
|
||||||
background: Color white;
|
|
||||||
margin: (BlInsets all: 10);
|
|
||||||
constraintsDo: [ :c |
|
|
||||||
c vertical exact: 145.
|
|
||||||
c horizontal matchParent ];
|
|
||||||
elementBuilder: [ each asCardElement margin: (BlInsets all: 20) ].
|
|
||||||
container addChild: imageContainer].
|
|
||||||
container asScrollableElement ]
|
|
@ -1,5 +0,0 @@
|
|||||||
accessing
|
|
||||||
printOn: aStream
|
|
||||||
super printOn: aStream.
|
|
||||||
aStream
|
|
||||||
nextPutAll: '( ',self size asString, ' Tweet(s) )'
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
size
|
|
||||||
^ self tweets size
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
tweets: aTweetsCollection
|
|
||||||
^ tweets := aTweetsCollection
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
tweets
|
|
||||||
^ tweets ifNil: [ tweets := OrderedCollection new]
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "",
|
|
||||||
"super" : "Object",
|
|
||||||
"category" : "Datanalitica-Datanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [ ],
|
|
||||||
"instvars" : [
|
|
||||||
"tweets"
|
|
||||||
],
|
|
||||||
"name" : "TweetsCollection",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
I model some parts of the Twitter API version 2 as described in:
|
|
||||||
|
|
||||||
<https://developer.twitter.com/en/docs/twitter-api/early-access>
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
apiKeysFile: aFileReference
|
|
||||||
apiKeysFile := aFileReference
|
|
@ -1,5 +0,0 @@
|
|||||||
accessing
|
|
||||||
apiKeysFile
|
|
||||||
"Return the defined apiKeysFile or assign a default location following the Linux Standard
|
|
||||||
File Hierarchy, which is relatively portable to other Operative Systems."
|
|
||||||
^ apiKeysFile ifNil: [ apiKeysFile := FileLocator home / '.config/Datanalitica/twitter-api-keys.json' ]
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
keys
|
|
||||||
^ keys ifNil: [ keys := Dictionary new]
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
loadKeys
|
|
||||||
keys := STONJSON fromString: self apiKeysFile contents.
|
|
||||||
^ keys
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
bearerToken
|
|
||||||
^ self class keys at: 'Bearer Token'
|
|
@ -1,7 +0,0 @@
|
|||||||
accessing
|
|
||||||
defaultQueryParameters
|
|
||||||
^ Dictionary new
|
|
||||||
at: 'tweetsOrig' put: '?tweet.fields=created_at&expansions=author_id&user.fields=created_at&max_results=100';
|
|
||||||
at: 'tweets' put: '?', 'tweet.fields=created_at', '&', 'expansions=author_id', '&', 'max_results=100';
|
|
||||||
at: 'mentionsOrig' put: '?expansions=author_id&tweet.fields=conversation_id,created_at,lang&user.fields=created_at,entities&max_results=100';
|
|
||||||
yourself
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
keys
|
|
||||||
^ keys ifNil: [ keys := self class loadKeys]
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
loadKeys
|
|
||||||
keys := self class loadKeys.
|
|
||||||
^ self
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
options: aDictionary
|
|
||||||
options := aDictionary
|
|
@ -1,9 +0,0 @@
|
|||||||
accessing
|
|
||||||
options
|
|
||||||
"Return the configuration options or define a default if they are not given"
|
|
||||||
^ options ifNil: [
|
|
||||||
options := Dictionary new
|
|
||||||
at: 'caching' put: true;
|
|
||||||
at: 'pagesPerRequest' put: '1';
|
|
||||||
yourself
|
|
||||||
]
|
|
@ -1,6 +0,0 @@
|
|||||||
accessing
|
|
||||||
rawResponseForURL: anUrl
|
|
||||||
^ ZnClient new
|
|
||||||
headerAt: 'Authorization' put: 'Bearer ', self bearerToken;
|
|
||||||
url: anUrl;
|
|
||||||
get.
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
storage: aFolder
|
|
||||||
|
|
||||||
storage := aFolder
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
storage
|
|
||||||
|
|
||||||
^ storage
|
|
@ -1,8 +0,0 @@
|
|||||||
accessing
|
|
||||||
userEndPointFor: username selecting: tweetsOrMentions
|
|
||||||
"I build a shared URL for querying last 100 mentions or tweets for a particular user.
|
|
||||||
Second parameter should be only 'tweets' or 'mentions', dateString, if present, should be YYYY-MM-DD."
|
|
||||||
| commonQueryParameters userFields |
|
|
||||||
userFields := 'user.fields=username,name,description,profile_image_url,created_at'.
|
|
||||||
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&', userFields, '&max_results=100'.
|
|
||||||
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters
|
|
@ -1,8 +0,0 @@
|
|||||||
as yet unclassified
|
|
||||||
userEndPointFor: username selecting: tweetsOrMentions since: dateString
|
|
||||||
"I build a shared URL for querying last 100 mentions or tweets for a particular user.
|
|
||||||
Second parameter should be only 'tweets' or 'mentions', dateString should be YYYY-MM-DD."
|
|
||||||
| commonQueryParameters |
|
|
||||||
commonQueryParameters := '?expansions=author_id&tweet.fields=conversation_id,created_at&user.fields=username&max_results=100',
|
|
||||||
'&start_time=', dateString,'T00:00:00Z&'.
|
|
||||||
^ self usersBaseEndPoint, (self userIDFrom: username), '/', tweetsOrMentions, commonQueryParameters
|
|
@ -1,5 +0,0 @@
|
|||||||
queries
|
|
||||||
userIDFrom: username
|
|
||||||
| rawResponse |
|
|
||||||
rawResponse := self rawResponseForURL: self usersBaseEndPoint, 'by/username/', username.
|
|
||||||
^ (STONJSON fromString: rawResponse) at: 'data' at: 'id'
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
userMentionsFor: username
|
|
||||||
"The following query gets the last 100 mentions that is the maximun allowed for a particular user without pagination:"
|
|
||||||
^ self userQueryFor: username selecting: 'mentions'
|
|
@ -1,18 +0,0 @@
|
|||||||
accessing
|
|
||||||
userMentionsFor: username since: startDateString
|
|
||||||
| nextToken queryUrl sinceDate untilDate messages response |
|
|
||||||
|
|
||||||
sinceDate := 'start_time=',startDateString, 'T00:00:00Z'.
|
|
||||||
messages := OrderedCollection new.
|
|
||||||
nextToken := ''.
|
|
||||||
[ nextToken includesSubstring: 'stop' ] whileFalse: [
|
|
||||||
queryUrl := self usersBaseEndPoint,
|
|
||||||
(self userIDFrom: username), '/mentions', (self defaultQueryParameters at: 'mentionsOrig') ,
|
|
||||||
'&', sinceDate,
|
|
||||||
'&', nextToken.
|
|
||||||
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
|
||||||
(response at: 'data') do: [:tweetData |
|
|
||||||
messages add: (Tweet new fromDictionary: tweetData)
|
|
||||||
].
|
|
||||||
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
|
||||||
^ messages.
|
|
@ -1,21 +0,0 @@
|
|||||||
accessing
|
|
||||||
userMentionsFor: username since: startDateString until: endDateString
|
|
||||||
| nextToken queryUrl sinceDate untilDate messages response extraQueryParamenters |
|
|
||||||
|
|
||||||
sinceDate := 'start_time=',startDateString, 'T17:00:00Z'.
|
|
||||||
untilDate := 'end_time=',endDateString, 'T01:00:00Z'.
|
|
||||||
extraQueryParamenters := '?expansions=author_id&tweet.fields=conversation_id&user.fields=created_at,entities&max_results=100'.
|
|
||||||
messages := OrderedCollection new.
|
|
||||||
nextToken := ''.
|
|
||||||
[ nextToken includesSubstring: 'stop' ] whileFalse: [
|
|
||||||
queryUrl := self usersBaseEndPoint,
|
|
||||||
(self userIDFrom: username), '/mentions', extraQueryParamenters,
|
|
||||||
'&', sinceDate,
|
|
||||||
"'&', untilDate,"
|
|
||||||
'&', nextToken.
|
|
||||||
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
|
||||||
(response at: 'data') do: [:tweetData |
|
|
||||||
messages add: (Tweet new fromDictionary: tweetData)
|
|
||||||
].
|
|
||||||
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
|
||||||
^ messages.
|
|
@ -1,10 +0,0 @@
|
|||||||
accessing
|
|
||||||
userQueryFor: username selecting: tweetsOrMentions
|
|
||||||
| rawResponse queryURL |
|
|
||||||
"The following query gets the last 100 tweets or mentions that is the maximun allowed for a particular user without pagination:"
|
|
||||||
queryURL := self userEndPointFor: username selecting: tweetsOrMentions.
|
|
||||||
rawResponse := self rawResponseForURL:queryURL.
|
|
||||||
^ TwitterAPIResponse new
|
|
||||||
fromDictionary: (STONJSON fromString: rawResponse);
|
|
||||||
queryURL: queryURL;
|
|
||||||
date: DateAndTime now.
|
|
@ -1,4 +0,0 @@
|
|||||||
accessing
|
|
||||||
userTweetsFrom: username
|
|
||||||
"The following query gets the last 100 tweets, that is the maximun allowed for a particular user without pagination:"
|
|
||||||
^ self userQueryFor: username selecting: 'tweets'
|
|
@ -1,20 +0,0 @@
|
|||||||
accessing
|
|
||||||
userTweetsFrom: username since: startDateString until: endDateString
|
|
||||||
| nextToken queryUrl sinceDate untilDate messages response |
|
|
||||||
|
|
||||||
sinceDate := 'start_time=',startDateString, 'T00:00:00Z'.
|
|
||||||
untilDate := 'end_time=',endDateString, 'T23:59:59Z'.
|
|
||||||
messages := OrderedCollection new.
|
|
||||||
nextToken := ''.
|
|
||||||
[ nextToken includesSubstring: 'stop' ] whileFalse: [
|
|
||||||
queryUrl := self usersBaseEndPoint,
|
|
||||||
(self userIDFrom: username), '/tweets', (self defaultQueryParameters at: 'tweets'),
|
|
||||||
'&', sinceDate,
|
|
||||||
'&', untilDate,
|
|
||||||
'&', nextToken.
|
|
||||||
response := STONJSON fromString: (self rawResponseForURL: queryUrl).
|
|
||||||
(response at: 'data') do: [:tweetData |
|
|
||||||
messages add: (Tweet new fromDictionary: tweetData)
|
|
||||||
].
|
|
||||||
nextToken := 'pagination_token=',((response at: 'meta') at: 'next_token' ifAbsent: [ 'stop' ])].
|
|
||||||
^ messages.
|
|
@ -1,3 +0,0 @@
|
|||||||
utilities api
|
|
||||||
usersBaseEndPoint
|
|
||||||
^ 'https://api.twitter.com/2/users/'
|
|
@ -1,10 +0,0 @@
|
|||||||
accessing
|
|
||||||
usersGroupMentioning: userName
|
|
||||||
| response |
|
|
||||||
response := self userQueryFor: userName selecting: 'mentions'.
|
|
||||||
^ TwitterUsersGroup new
|
|
||||||
users: response messagesAuthors;
|
|
||||||
title: 'Users mentioning @', userName;
|
|
||||||
origin: response queryURL;
|
|
||||||
date: DateAndTime now;
|
|
||||||
storage: self storage.
|
|
@ -1,3 +0,0 @@
|
|||||||
accessing
|
|
||||||
usersMentioning: userName
|
|
||||||
^ (self userMentionsFor: userName) messagesAuthors
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"commentStamp" : "<historical>",
|
|
||||||
"super" : "Object",
|
|
||||||
"category" : "Datanalitica",
|
|
||||||
"classinstvars" : [ ],
|
|
||||||
"pools" : [ ],
|
|
||||||
"classvars" : [
|
|
||||||
"apiKeysFile",
|
|
||||||
"keys"
|
|
||||||
],
|
|
||||||
"instvars" : [
|
|
||||||
"storage",
|
|
||||||
"options",
|
|
||||||
"keys"
|
|
||||||
],
|
|
||||||
"name" : "TwitterAPI",
|
|
||||||
"type" : "normal"
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user