First time used Twitter
API. Since you did not declared (like Ecto.Schema
or just documentation) I was not always sure if I pass a correct data or to a correct field. Also I wrote everything in format I saw on Twitter
(see item.title
). Let me know if that works as you expected. If needed I can update it anytime you want.
Code is obviously working, but I think that you may want to adjust some query parameters. For this I made it really customizable by query
, params
and comment_params
.
iex> Feeds.TwitterAPIv2.get_channel(%{bearer_token: "MY_SECRET_BEARER_TOKEN", query: "from:josevalim"})
%Rss.Channel{
atom_link: "https://api.twitter.com/2/tweets/search/recent?expansions=attachments.media_keys%2Cauthor_id&media.fields=url&query=from%3Ajosevalim&tweet.fields=created_at%2Clang%2Creferenced_tweets%2Csource&user.fields=description%2Cprofile_image_url%2Curl",
category: nil,
cloud: nil,
copyright: nil,
description: "Chief Adoption Officer at @dashbit. Creator of @elixirlang. Tweets once in a while. Rarely livestreams at https://t.co/lfDi8qz7jD.",
docs: "https://www.rssboard.org/rss-specification",
generator: "Name of My Project",
image: "https://pbs.twimg.com/profile_images/667973757181431808/IdQgSAH__normal.jpg",
items: [
%Rss.Item{
author: "José Valim",
category: nil,
comments: [],
description: "<p>RT @bostonvaulter: I'm pleased to announce DepViz, a new tool to visualize elixir compilation dependencies that I released today at #CodeB…</p>",
enclosure: nil,
guid: "1325712715285934081",
link: "https://twitter.com/josevalim/status/1325712715285934081",
pubDate: #DateTime<2020-11-09 08:11:56.000-05:00 EST America/New_York>,
source: "Twitter Web App",
title: "José Valim @josevalim · 9 Nov"
},
%Rss.Item{
author: "José Valim",
category: nil,
comments: [],
description: "<p>RT @kipcole9: Published an introduction to Language Tags for Elixir programmers interested in I18n at https://t.co/904hbWxWN2 #myelixirstat…</p>",
enclosure: nil,
guid: "1325712696151564288",
link: "https://twitter.com/josevalim/status/1325712696151564288",
pubDate: #DateTime<2020-11-09 08:11:51.000-05:00 EST America/New_York>,
source: "Twitter Web App",
title: "José Valim @josevalim · 9 Nov"
},
%Rss.Item{
author: "José Valim",
category: nil,
comments: [],
description: "<p>RT @kry10_limited: New blog post: Overview of the Kry10 Secure Platform\n(Mostly about the OS)\n\nhttps://t.co/B9A7D6ucuV\n\n#seL4 #Erlang #Elix…</p>",
enclosure: nil,
guid: "1325712563661910016",
link: "https://twitter.com/josevalim/status/1325712563661910016",
pubDate: #DateTime<2020-11-09 08:11:20.000-05:00 EST America/New_York>,
source: "Twitter Web App",
title: "José Valim @josevalim · 9 Nov"
},
%Rss.Item{
author: "José Valim",
category: nil,
comments: [],
description: "<p>RT @remote: Mental health matters most.\n\nWhen you work remotely, remember:\n\n❌ Stop working on breaks. Work is not a break.\n❌ Don't overcomm…</p>",
enclosure: nil,
guid: "1324731327640461313",
link: "https://twitter.com/josevalim/status/1324731327640461313",
pubDate: #DateTime<2020-11-06 15:12:15.000-05:00 EST America/New_York>,
source: "Twitter Web App",
title: "José Valim @josevalim · 6 Nov"
}
],
language: nil,
lastBuildDate: #DateTime<2020-11-09 08:11:56.000-05:00 EST America/New_York>,
link: "https://t.co/OFJNxHxlKf",
managingEditor: nil,
pubDate: #DateTime<2020-11-09 08:11:56.000-05:00 EST America/New_York>,
rating: nil,
skipDays: nil,
skipHours: nil,
textInput: nil,
title: "José Valim (@josevalim) / Twitter",
ttl: nil,
webMaster: nil
}
Note: For this to work you need a Twitter
developer account, but since everyone can create it you can simply ask about Bearer
authorization token.