Analyse: Orte, Location via Instagram und Facebook

Ich hatte in diversen Gesprächen und sonstigen Statements angedeutet, dass wir einige Experimente (spez. Likes, Socialmediautomatisierungen und Contentmarketingansaetze) mit den Erkenntnissen aus „Locations“ durchführen. Diese sind flächendeckend positiv ausgegangen. Die nachfolgenden Quellcodes stammen aus dem aktuellen Recherchetool (INSTA-FINAL)

Ich nutze die Daten für das Abarbeiten folgender Szenarien:
(a) Liken via Instafinal
(b) konkrete Firmen und Locationanalyse
-> Was wird geschrieben?
-> Wieviele Menschen sind da WANN aktiv und was schreiben die, was
bewegt die?
-> Vorbereitungen auf Messen, da Messen selbstverständlich Locations sind.
-> Vorbereitungen auf konkrete Messegespräche
-> Aufbereitung der Daten für die üblichen Akquisevorbereitungen
-> Erkenntnisgewinnung, Inspiration für div. Contentmarketingansätze
(c) Hashtagrecherchen

//-> Locationrechercheprozedur

1. Schritt: Token von Facebook besorgen

How to get a Facebook Access Token

2. Schritt: Mit Facebook-Token nach Orten, Firmen usw. suchen

procedure TForm1.Button42Click(Sender: TObject);
var l_clear: integer;
var
JSONArray: tJSONArray;
JSONValue,jvalue: tJSONValue;
JSONPair: TJSONPair;
JSON, json_sub: TJSONObject;
size: integer;
j_array: tJSONArray;
s: string;
i,j: integer;
next_id: string;
chk_br: char;
begin
locsearch.text := StringReplace(locsearch.text, ‚ ‚, ‚+‘,
[rfReplaceAll, rfIgnoreCase]);
listbox2.Items.Clear;
with locs do
begin
cells[0,0]:=’Nr.‘;
cells[1,0]:=’Name‘;
cells[2,0]:=’ID-Code‘;
cells[3,0]:=’URL‘;
colcount:=4;
rowcount:=1;
end;
try
with debug do
begin
clear;
text:=idhttp1.Get(‚https://graph.facebook.com/search?q=’+locsearch.Text+’&type=place&access_token=’+fbtoken.text);
end;
JSONValue := TJSONObject.ParseJSONValue(debug.text);
JSON := TJSONObject.ParseJSONValue(debug.Lines.Text) as TJSONObject;
JSONArray := TJSONArray(JSON.Get(‚data‘).JsonValue);
memo1.Clear;
for i := 0 to JSONArray.Size – 1 do
begin
with locs do
begin
cells[0,rowcount]:=inttostr(rowcount);
cells[1,rowcount]:=TJSONPair(TJSONObject(JSONArray.Get(i)).Get(’name‘)).JsonValue.Value;
listbox2.Items.Add(cells[1,rowcount]);
cells[2,rowcount]:=TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚id‘)).JsonValue.Value;
cells[3,rowcount]:=’https://www.instagram.com/explore/locations/’+cells[2,rowcount]+’/‘;
rowcount:=rowcount+1;
end;
end;
grdColWidth(locs, 40);
except
end;
end;

3. Schritt: Medien aus Locations abholen und ggf. analysieren

procedure TForm1.get_loc_short(mytable: TStringGrid; locid: string);
var
JSONArray: tJSONArray;
JSONValue,jvalue: tJSONValue;
JSONPair: TJSONPair;
JSON, json_sub: TJSONObject;
size: integer;
j_array: tJSONArray;
s: string;
i,j: integer;
next_id: string;

begin
with mytable do
begin
cells[0,0]:=’Nr.‘;
cells[1,0]:=’URL‘;
cells[2,0]:=’Tag‘;
cells[3,0]:=’Likes‘;
cells[4,0]:=’Comments‘;
cells[5,0]:=’Erstellzeit‘;
cells[6,0]:=’ID‘;
colcount:=7;
rowcount:=1;
end;
memo3.Lines.Add(‚url =>
https://api.instagram.com/v1/locations/’+locid+’/media/recent?access_token=’+token.text);
memo3.Lines.SaveToFile(verz+’\tmp_mediaurlsapi.txt‘);
try
debug.text:=idhttp1.Get(‚https://api.instagram.com/v1/locations/’+locid+’/media/recent?access_token=’+token.text);
debug.text:=idhttp1.Get(‚https://www.instagram.com/explore/tags/’+tagsuche+’/?__a=1‘);
JSONValue := TJSONObject.ParseJSONValue(debug.text);
JSON := TJSONObject.ParseJSONValue(debug.Lines.Text) as TJSONObject;
JSONArray := TJSONArray(JSON.Get(‚data‘).JsonValue);
try next_id:= JSONValue.GetValue(‚pagination.next_url‘);
except
end;
for i := 0 to JSONArray.Size – 1 do
begin
with mytable do
begin
cells[0,rowcount]:=inttostr(rowcount);
cells[1,rowcount]:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚link‘)).JsonValue.Value);
s:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚tags‘)).ToString);
s:= StringReplace(s, ‚“tags“:[‚, “, [rfReplaceAll,rfIgnoreCase]);
s:= StringReplace(s, ‚]‘, “, [rfReplaceAll,rfIgnoreCase]);
cells[2,rowcount]:=s;
s:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚likes‘)).ToString);
s:= StringReplace(s, ‚“likes“:{„count“:‘, “,
[rfReplaceAll,rfIgnoreCase]);
s:= StringReplace(s, ‚}‘, “, [rfReplaceAll,rfIgnoreCase]);
cells[3,rowcount]:=s;
s:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚comments‘)).ToString);
s:= StringReplace(s, ‚“comments“:{„count“:‘, “,
[rfReplaceAll,rfIgnoreCase]);
s:= StringReplace(s, ‚}‘, “, [rfReplaceAll,rfIgnoreCase]);
cells[4,rowcount]:=s;
cells[5,rowcount]:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚created_time‘)).JsonValue.Value);
cells[5,rowcount]:=datetimetostr(UnixToDateTime(strtoint(cells[5,rowcount])));
cells[6,rowcount]:=(TJSONPair(TJSONObject(JSONArray.Get(i)).Get(‚id‘)).JsonValue.Value);
rowcount:=rowcount+1;
end;
grdColWidth(mytable, 40);
end;
except
end;
//uebertrag auf tabelle
grdColWidth(mytable, 40);
form1.Caption:=version+‘ alle Posts herunter geladen‘;
end;

Schreibe einen Kommentar