Im trying to extract a hashtag out of a list that im retrieving when using the twiter api.
I use this to extract the hashtag:
case extract(<<"entities">>, L) of
{found, {TE}} ->
{found, Hashtags} = extract(<<"hashtags">>, TE);
not_found -> Hashtags = hash_not_found
end,
extract(K, L) ->
case lists:keyfind(K, 1, L) of
{_, M} -> {found, M};
false -> not_found
end.
This gives me a hashtag in the format:
[{[{<<"text">>,<<"London">>},{<<"indices">>,[120,127]}]}]
I wish to extract the hashtag only out of that, which would be London in this case. This tag will differ each time I extract tweets though. Any idea or suggestion is appreciated.
I do not wish to change earlier code unless I really have to. Id prefer to learn how to extract what I need from that list.
Guessing at what
extractfunction does, something like this should work:See also
proplistsmodule in the standard library.