Closed nicholaschiang closed 2 years ago
From @nicholaschiang on Monday, 2/28/22, 1:09 PM PST:
Iteration two:
hive.one
in batches of 100.Trying to run all of that with Cloudflare Workers probably isn't the best idea. I tried building it--and got something that kinda works--but working within Cloudflare's serverless constraints (e.g. max 50 subrequests--including cache calls--per worker invocation, max 16 recursive calls per worker invocation, etc) greatly hinders my ability to generate a complete truth dataset that accounts for every tweet (accessible from Twitter's API) from every influencer (from Hive's API). Thus, it's impossible to say if this whole Tweetscape algorithm would even work to surface useful "insider" information and articles. Currently, it kinda works for Tesla, but is quite low quality everywhere else (and even the links in the Tesla topic are greatly skewed towards a few reporting companies that write solely about Tesla).
I think iteration three would look something like:
tweetscape.co
(or every 24 hours with a CRON trigger).From @nicholaschiang on Sunday, 2/27/22, 12:22 AM PST:
Update:
hive.one
tesla
or ethereum
) as a search keywordhas:links
)from:elonmusk
)
twitter.com
)score
sum)
hive.one
(and thus we don't know the original author's attention score)hive.one
if it wasn't included in the top 100 fetched earlierHTMLRewriter
to parse the article title
and description
meta tagstitle
and description
are found; meta tags are always in the document <head>
which is at the top, so there's no need to download the entire thingtitle
and description
of a site protected by Cloudflare (e.g. a number of the dogecoin
articles are from change.org
which uses Cloudflare DDoS)The aforementioned algorithm works OK for tesla
, but isn't as effective for other topics.
From @nicholaschiang on Friday, 2/25/22, 11:27 PM PST:
See: https://tweetscape.nicholaschiang.workers.dev/tesla for WIP
From @nicholaschiang on Friday, 2/25/22, 11:27 PM PST:
Working fine right now; I'll need access to our custom domain name to further optimize performance (which is currently quite slow as I'm fetching data from both Hive and Twitter on each page load).
To optimize performance on Remix + Cloudflare:
To optimize performance on Next.js + Vercel:
HTMLRewriter
and cfs
) with Node.js modules (e.g. metascraper
and got
) that can do the same things.Now that I've developed a basic working version, I'm actually thinking that this would be a perfect application for ISR. However, I'm also intrigued by Remix's blog post which demonstrates that hosting Remix entirely on the edge (e.g. on Fly.io or Cloudflare) is actually faster than Next.js ISR. However, as the time it takes to fetch page data and generate dynamic content increases, using ISR begins to make more and more practical sense. The attraction of Remix is based on the assumption that whatever APIs you're consuming in your loader
function will respond in ms
and not sec
.
Imported from @nicholaschiang's original Linear issue TS-12.
From the
README
:How it works
High level
Tweetscape uses
hive.one
to determine who are the most reputable (i.e. the "smartest") people in a specific field (e.g. who are the experts in ETH, BTC, NFTs, or Tesla) on Twitter;hive.one
acts as a reputation layer for the internet, determining who you can trust through a weighted graph of who follows who (e.g. a reputable user following another user raises that other user's "attention score" by more than if some random Joe follows them).Tweetscape then uses Twitter's API and that list of "smartest" people to get links to the articles most abundantly (and most recently) shared by the "smartest" people on Twitter for a given topic (e.g. ETH, BTC, NFTs, or Tesla). It also shows you the conversation around each link; you get to see the best links and what the smartest people are saying about them.
Low level
Tweetscape is a full-stack React application built with Remix and React Router.
Every 24 hours, when a user visits
tweetscape.com
, we:hive.one
(using anETag
to de-dupe requests):GET
https://api.hive.one/v1/influencers/top
TODO: Figure out the best, most performant way to do this. Perhaps I'll setup a webhook or use some type of persistent storage to only query for changes (i.e. new Tweets) shared by our top influencers.
The aforementioned fetched data and generated HTML are both cached at the edge with Redis and SWR, respectively. We actually run the application at the edge too with Fly.io. One of our goals with Tweetscape is to save you time—primarily by rescuing you from Twitter's arbitrary wormhole of a feed—but also by optimizing our app to run even faster than Twitter, saving you milliseconds that you can then spend learning about the wisdom age 😎.