59 points · by vednig · 1y ago · 27 comments
I'm Ved, I came across the pain point of having a reader that could provide threads as articles after scrolling them many times and missing the context of the original info shared.
To solve my itch I decided to build a thread reader without Ads(all existing sol. were full of them), since X/Twitter API was very pricey, I did some reverse engineering to convert rendered X.com/twitter pages to an API and host it in a VM (which obv. was dead cheap).
All of your data is saved in LocalStorage. Including your comments and saved threads(there is a known issue with Linux and MacOS browsers i think).
Code is open-sourced at : https://github.com/vednig/unlaceapp
App is available at : https://unlace.app
There are two views inbuilt in app
https://unlace.app/?url=https://x.com/ianwcrosby/status/1872...
https://unlace.app/thread/ianwcrosby/status/1872724231999381...
Reverse Engineered X API is available at https://xapi.betaco.tech/x-thread-api?url=https%3A%2F%2Fx.co...
Meanwhile you can enter any twitter thread url on https://unlace.app to get a clean and read friendly article.
Here's the stack(if anyone's interested):
- NextJS
- FastAPI
- Selenium
That's all folks, looking towards a productive feedback session.
This one loaded: https://unlace.app/thread/ianwcrosby/status/1872724231999381..., but oddly it's duplicating the thread.
Replace "x.com" by "xcancel.com" (or some other still working Nitter instance) and you're set. https://xcancel.com/ianwcrosby/status/1872724231999381790
This is the issue with Nitter instances; they seem too ephemeral for reliable use.
Since each new request takes high time and processing power, it was only logical to store responses and cache them for timely usage.
There's also a bit of a workaround required to get videos from X.com as they only load their direct URL when focused hence parsing html couldn't work, so I had to log network traffic to ensure I get their HLS links too.
if not uniquetwid.__contains__(i['tweet_id']):
finalresponse.append(i)
print(i)
Let's Enjoy, reading unrepeated threads now !And since it's highly cached based on unique url requests, it persists, I'm thinking of having a purge cache option too, I'd have to think how to implement it so as to prevent abuse as well.
I made a similar tool, except it's a browser extension that lets you download threads as markdown (then it's up to you to dump them into a DB or train a model on them or whatever), I'd love to get your feedback https://chromewebstore.google.com/detail/thread-to-markdown/... (firefox version also available)
Edit: Example output using tweet thread mentioned elsewhere in this post https://sharetext.io/c04b7c82
Your extension somehow crashed on my system while downloading a thread(i couldn't see download button), I was able to get 1 md file downloaded though and I'd say it does it's job nicely, in the highest manner.
Feature Request: Make download button compatible with Dark Mode(currently it stands out loud)
May I ask what you use the markdown for after its downloaded? Would you modify the output at all to make it better fit your use case?
I downloaded this tweet, for example, this can give you an idea about potential usecases https://x.com/ThePrimeagen/status/1873778477448782035
Here are few things to consider:
- First unique request for X might take time (time increase is directly proportional to number of comments on a post)
- If Internet Archive and Archive.today have a limit for crawled request this may affect them (only first time)
- Links to profile in Unlace are currently not 100% accurate all the time
I'm currently looking for ways to resolve these issues, in the server. Meanwhile feel free use it as you may, there's no T&C or Privacy Policy in service because there's nearly zero data collection and infinite use cases to explore(star trek reference).
Doesn't load with Javascript disabled
https://unlace.app/thread/ianwcrosby/status/1872724231999381...
Does load with Javascript disabled.
Why one yes, the other no?
Both use nearly the same logic. You can view them in the repo
1. https://github.com/vednig/unlaceapp/blob/main/app/page.tsx
2.https://github.com/vednig/unlaceapp/blob/main/app/thread/%5B...
So it was only logical to go through the pain/pleasure of setting up deployment on VM.
Python Backend is deployed on Azure VM(with 4 GB), since it's built on Fastapi their AWSGI support helps keep the server running on long intervals.
This one is using CF Tunnels to Prod to reduce the latency due to server location.
You can see uvicorn docs to learn more https://www.uvicorn.org/