<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: leadwright</title>
    <description>The latest articles on DEV Community by leadwright (@leadwright).</description>
    <link>https://dev.to/leadwright</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4243490%2F60095556-a2bc-473b-9454-88ae24f2e2e8.png</url>
      <title>DEV Community: leadwright</title>
      <link>https://dev.to/leadwright</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leadwright"/>
    <language>en</language>
    <item>
      <title>Automating X (Twitter) in 2026: shadow DOM, 429 lockouts, and the Premium gate</title>
      <dc:creator>leadwright</dc:creator>
      <pubDate>Fri, 13 Nov 2026 19:16:24 +0000</pubDate>
      <link>https://dev.to/leadwright/automating-x-twitter-in-2026-shadow-dom-429-lockouts-and-the-premium-gate-19bp</link>
      <guid>https://dev.to/leadwright/automating-x-twitter-in-2026-shadow-dom-429-lockouts-and-the-premium-gate-19bp</guid>
      <description>&lt;h1&gt;
  
  
  Automating X (Twitter) in 2026: shadow DOM, 429 lockouts, and the Premium gate
&lt;/h1&gt;

&lt;p&gt;I spent a few weeks building a lead-search tool for X. Not a scraper library — a thing that&lt;br&gt;
runs in a real browser, signed in as a real account, and tries to behave like a person while&lt;br&gt;
it looks for accounts worth contacting.&lt;/p&gt;

&lt;p&gt;Almost everything I assumed was wrong. This is the list of things that broke, and what&lt;br&gt;
actually worked.&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Every profile visit is a full app boot
&lt;/h2&gt;

&lt;p&gt;X's people search gives you handles and almost nothing else. Follower counts, bios, join&lt;br&gt;
dates — all of it lives on the profile page, and every profile page load is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a GraphQL &lt;code&gt;Viewer&lt;/code&gt; request,&lt;/li&gt;
&lt;li&gt;the full React app booting,&lt;/li&gt;
&lt;li&gt;a pile of static assets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do that 30–40 times in a row and X answers &lt;strong&gt;HTTP 429&lt;/strong&gt;. After that, x.com stops booting at&lt;br&gt;
all — in &lt;em&gt;every&lt;/em&gt; browser on that IP, logged in or not — for somewhere between 30 and 60&lt;br&gt;
minutes. Not a soft limit on one endpoint. The whole site.&lt;/p&gt;

&lt;p&gt;The only reliable early signal I found was the &lt;code&gt;#ScriptLoadFailure&lt;/code&gt; element, plus the&lt;br&gt;
&lt;code&gt;1003&lt;/code&gt; code in the &lt;code&gt;Viewer&lt;/code&gt; response body. Once you see it, you're done for the hour.&lt;/p&gt;

&lt;p&gt;The important part is what you do next: &lt;strong&gt;nothing&lt;/strong&gt;. Retrying is the failure mode. A naive&lt;br&gt;
&lt;code&gt;for attempt in range(3)&lt;/code&gt; turns a 20-minute lockout into an hour, because each retry is&lt;br&gt;
another full app boot against a counter that's already tripped.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;locator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#ScriptLoadFailure"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;RateLimited&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"X is refusing to serve the app; back off, do not retry"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Failure fast beats retrying with backoff, because the cost isn't the failed request — it's&lt;br&gt;
the &lt;em&gt;next&lt;/em&gt; 40 requests that now can't happen.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. DMs moved into a separate app that renders in a shadow root
&lt;/h2&gt;

&lt;p&gt;The old DM page is gone. &lt;code&gt;/messages&lt;/code&gt; now hands you over to &lt;code&gt;/i/chat&lt;/code&gt;, an embedded React app&lt;br&gt;
served from &lt;code&gt;abs.twimg.com/x-web/xchat/embed/&lt;/code&gt;. It renders into &lt;strong&gt;shadow roots&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That breaks the two things every scraper does first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[data-testid="dm-composer"]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// null&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;innerText&lt;/span&gt;                                 &lt;span class="c1"&gt;// "" for the chat panel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;innerText&lt;/code&gt; on &lt;code&gt;body&lt;/code&gt; genuinely returns nothing useful, because the chat UI is inside a&lt;br&gt;
shadow tree, and shadow content isn't part of the host's text.&lt;/p&gt;

&lt;p&gt;You can walk it by hand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;walk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;depth&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;el&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bodyText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;texts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;+/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But here's the thing that took me too long to check: &lt;strong&gt;Playwright's CSS engine pierces open&lt;br&gt;
shadow roots already&lt;/strong&gt;. &lt;code&gt;page.locator('[data-testid="..."]')&lt;/code&gt; finds elements inside shadow&lt;br&gt;
DOM without any traversal. My problem was never reachability — it was that I was using&lt;br&gt;
selectors that no longer existed.&lt;/p&gt;

&lt;p&gt;So don't guess the names. Read them out of the bundle:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Load &lt;code&gt;/i/chat&lt;/code&gt;, capture the script responses from &lt;code&gt;abs.twimg.com/x-web/xchat/embed/assets/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Grep the chunks for &lt;code&gt;dm-&lt;/code&gt; strings.&lt;/li&gt;
&lt;li&gt;You get the real vocabulary: &lt;code&gt;dm-composer-textarea&lt;/code&gt;, &lt;code&gt;dm-composer-send-button&lt;/code&gt;,
&lt;code&gt;dm-message-scroller&lt;/code&gt;, &lt;code&gt;dm-conversation-panel&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Mine shipped filenames in backticks, so a quote-only regex missed most of them — a plain&lt;br&gt;
&lt;code&gt;grep -o 'dm-[a-z-]*'&lt;/code&gt; found ~40 testids, the quote-matched one found five.&lt;/p&gt;

&lt;p&gt;One more trap: the composer is a &lt;strong&gt;controlled React textarea&lt;/strong&gt;. &lt;code&gt;locator.fill()&lt;/code&gt; sets the DOM&lt;br&gt;
value but doesn't fire the synthetic events React listens to, so the send button stays&lt;br&gt;
disabled and the message never sends. Real keystrokes work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;composer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keyboard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. The composer isn't always rendered — and there's no error
&lt;/h2&gt;

&lt;p&gt;If the account isn't verified and the recipient doesn't follow it, X doesn't render the&lt;br&gt;
composer at all. What you get is a dialog:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Get verified to message @user — Only verified users can send Direct Message requests to&lt;br&gt;
people that don't follow them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Dismissing that dialog does not reveal a composer. There is no textarea, no&lt;br&gt;
&lt;code&gt;contenteditable&lt;/code&gt;, no &lt;code&gt;role="textbox"&lt;/code&gt; — nothing to type into, anywhere in the document or&lt;br&gt;
its shadow roots.&lt;/p&gt;

&lt;p&gt;If your automation assumes the composer exists, it doesn't fail loudly: it fails &lt;em&gt;per&lt;br&gt;
target&lt;/em&gt;, quietly, thirty times in a row, while burning the rate-limit budget from section 1.&lt;br&gt;
That's how I ended up locked out on the first real run.&lt;/p&gt;

&lt;p&gt;Detect the condition once and stop the whole run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"get verified to message"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;body_text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;AccountGated&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"X requires verification for cold DMs"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This isn't a bug you can code around. It's a product decision on X's side, and the only&lt;br&gt;
honest responses are "pay for Premium" or "find another channel".&lt;/p&gt;


&lt;h2&gt;
  
  
  4. The chat app asks for a PIN the first time
&lt;/h2&gt;

&lt;p&gt;Open a conversation in a fresh browser profile and &lt;code&gt;/i/chat&lt;/code&gt; asks for an X Chat passcode —&lt;br&gt;
a 4-digit PIN, presented as four inputs. They're shadow-DOM children, and Playwright's&lt;br&gt;
&lt;code&gt;fill()&lt;/code&gt; on them is flaky because of how the component handles focus.&lt;/p&gt;

&lt;p&gt;What worked: focus the first input from &lt;em&gt;inside&lt;/em&gt; the page, then send real keystrokes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;boxes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;walk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'input[aria-label^="Digit "]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;boxes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shadowRoot&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shadowRoot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;walk&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;boxes&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;focus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;code&gt;page.keyboard.type(pin, delay=180)&lt;/code&gt;. The delay matters; the component advances focus&lt;br&gt;
per keystroke, and typing too fast drops digits.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Profile data is cleaner in the JSON-LD than in the DOM
&lt;/h2&gt;

&lt;p&gt;Scraping the profile DOM gives you localized follower counts (&lt;code&gt;12,4 тис.&lt;/code&gt;) and translated&lt;br&gt;
bios. There's a &lt;code&gt;&amp;lt;script type="application/ld+json"&amp;gt;&lt;/code&gt; block instead, with a&lt;br&gt;
&lt;code&gt;UserProfileSchema&lt;/code&gt; object containing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;exact &lt;code&gt;userInteractionCount&lt;/code&gt; for followers,&lt;/li&gt;
&lt;li&gt;the raw, untranslated bio,&lt;/li&gt;
&lt;li&gt;the numeric user id.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last one is the useful part. With a numeric id you can deep-link straight to a&lt;br&gt;
conversation instead of hunting for a localized "Message" button.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Search results are mostly noise
&lt;/h2&gt;

&lt;p&gt;The unexpected finding: X's people search returns a &lt;em&gt;lot&lt;/em&gt; of accounts that have nothing to do&lt;br&gt;
with the query. Searching for a niche term gives you local trends, unrelated verified&lt;br&gt;
accounts, and people who mentioned the word once in 2021.&lt;/p&gt;

&lt;p&gt;A cheap local relevance gate — the query term (or a synonym) must appear in the bio or display&lt;br&gt;
name — cut &lt;strong&gt;85 raw handles down to 7 on-topic accounts&lt;/strong&gt;. That ratio is the actual value of&lt;br&gt;
the tool; the scraping is the easy part.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I'd tell someone starting this today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Back off before you're told to.&lt;/strong&gt; The 429 isn't per-request, it's per-session, and the
recovery cost is measured in tens of minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the JS bundle&lt;/strong&gt; before writing selectors. Test IDs are in there; guessing costs days.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assume the UI you need isn't rendered.&lt;/strong&gt; Gate checks are cheaper than retries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat shadow DOM as a normal DOM.&lt;/strong&gt; Playwright handles it; your old selectors don't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter locally.&lt;/strong&gt; The search API won't do it for you, and relevance is the product.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you've automated a shadow-DOM app like this, I'd like to know how you test it — replaying&lt;br&gt;
against a live account for every selector change doesn't scale, and I haven't found a&lt;br&gt;
satisfying answer.&lt;/p&gt;

</description>
      <category>python</category>
      <category>webdev</category>
      <category>automation</category>
      <category>playwright</category>
    </item>
  </channel>
</rss>
