<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by SEO Tanvir BD on Medium]]></title>
        <description><![CDATA[Stories by SEO Tanvir BD on Medium]]></description>
        <link>https://medium.com/@seotanvirbd?source=rss-fd5b347e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*un8O7NbGnuWNDy6H4SggbA.jpeg</url>
            <title>Stories by SEO Tanvir BD on Medium</title>
            <link>https://medium.com/@seotanvirbd?source=rss-fd5b347e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 14:36:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seotanvirbd/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[I Built a Free Chrome Extension That Writes Facebook Comments With AI — Here’s the Full Code…]]></title>
            <link>https://medium.com/@seotanvirbd/i-built-a-free-chrome-extension-that-writes-facebook-comments-with-ai-heres-the-full-code-1e51c9a8447b?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e51c9a8447b</guid>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 02:00:47 GMT</pubDate>
            <atom:updated>2026-08-10T02:00:47.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Free Chrome Extension That Writes Facebook Comments With AI — Here’s the Full Code Breakdown</h3><p><em>How a simple annoyance turned into a working Manifest V3 extension using MutationObserver, three AI providers, and a language-matching prompt trick.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwClzbuoWyOqhOSgjUFD5w.png" /></figure><h3>The Problem I Was Trying to Solve</h3><p>If you run a Facebook page, manage a community, or just try to stay active in groups, you know the drill: dozens of posts a day, and every single one “deserves” a thoughtful comment if you want the algorithm — and real people — to notice you. Typing genuine, on-topic replies all day doesn’t scale.</p><p>I didn’t want a separate AI chat tab where I write a prompt, copy the output, switch back to Facebook, and paste it in. That’s still manual work. I wanted <strong>one click, inside Facebook, using an editor Facebook already trusts.</strong></p><p>So I built the <strong>AI Facebook Comment Generator (Lite)</strong> — a free Chrome extension that injects an AI button directly into Facebook’s comment box. Click it, and it reads the post, writes a natural reply in the <em>same language</em> as the original, and types it into the box for you to review and post.</p><p>The full source code is free. This article walks through exactly how it works, and the real engineering problems I had to solve to make it reliable on a platform that changes its DOM constantly.</p><h3>What It Actually Does (Demo Scenario)</h3><ol><li>You open Facebook and click into any comment box — on a post, a reel, a group, anywhere.</li><li>A small round AI icon appears inside Facebook’s own comment toolbar.</li><li>Click it. The extension reads the post’s text (or the comment you’re replying to), sends it to your chosen AI provider, and types the generated reply directly into the box using Facebook’s native editor.</li><li>You review it and hit Facebook’s own <strong>Comment</strong> button.</li></ol><p>No copy-paste. No separate tab. Free for 10 comments a day, and it supports <strong>OpenAI, Groq, and Google Gemini</strong> — you bring your own API key, so there’s no subscription lock-in.</p><h3>Architecture Overview</h3><p>The extension is a standard <strong>Manifest V3</strong> content script setup:</p><pre>{<br>  &quot;manifest_version&quot;: 3,<br>  &quot;permissions&quot;: [&quot;storage&quot;],<br>  &quot;host_permissions&quot;: [<br>    &quot;https://*.facebook.com/*&quot;,<br>    &quot;https://api.groq.com/*&quot;,<br>    &quot;https://api.openai.com/*&quot;,<br>    &quot;https://generativelanguage.googleapis.com/*&quot;<br>  ],<br>  &quot;content_scripts&quot;: [{<br>    &quot;matches&quot;: [&quot;https://www.facebook.com/*&quot;, &quot;https://web.facebook.com/*&quot;],<br>    &quot;js&quot;: [&quot;content.js&quot;],<br>    &quot;run_at&quot;: &quot;document_idle&quot;<br>  }]<br>}</pre><p>Only storage permission is needed — no activeTab, no broad host access beyond Facebook and the three AI APIs. That matters both for user trust and for a smoother Chrome Web Store review.</p><p>The content.js file is organized into clear modules, each with a single job:</p><pre>CONFIG        → selectors, model lists, the AI system prompt, timeouts<br>Utils         → DOM query helpers with fallback chains + debug logging<br>DomExtractor  → reads the post/comment text and builds the AI prompt<br>AIService     → calls OpenAI / Groq / Gemini, handles model fallback<br>EditorHandler → writes the AI reply back into Facebook&#39;s editor safely<br>UIInjector    → creates and places the AI button<br>Scanner       → MutationObserver + backup polling to catch new comment boxes<br>Upgrade/License → daily free-limit counter + Pro unlock check</pre><p>This separation made debugging <em>so</em> much easier once Facebook inevitably changed something.</p><h3>Problem #1: Facebook’s DOM Is a Moving Target</h3><p>Facebook doesn’t use stable class names — they’re auto-generated and change often. If I hardcoded one CSS selector for the comment box, the extension would silently break the next time Facebook shipped an update.</p><p>The fix: every selector is an <strong>ordered list of fallback candidates</strong>, tried in sequence until one matches.</p><pre>SELECTORS: {<br>  commentEditor: [<br>    &#39;div[data-lexical-editor=&quot;true&quot;][contenteditable=&quot;true&quot;][role=&quot;textbox&quot;]&#39;,<br>    &#39;div[contenteditable=&quot;true&quot;][role=&quot;textbox&quot;][aria-label^=&quot;Comment as &quot;]&#39;,<br>    &#39;form[role=&quot;presentation&quot;] div[contenteditable=&quot;true&quot;][role=&quot;textbox&quot;]&#39;,<br>  ],<br>  toolbar: [&#39;#focused-state-actions-list ul&#39;, &#39;#focused-state-actions-list&#39;],<br>  ...<br>}</pre><p>And the helper that walks the list logs exactly which candidate worked (or didn’t), so if something breaks I can open the console and know immediately which selector needs a new fallback — instead of guessing:</p><pre>findOne(root, selectors, label = &#39;unknown&#39;) {<br>  for (let i = 0; i &lt; selectors.length; i++) {<br>    const el = root.querySelector(selectors[i]);<br>    if (el) {<br>      console.log(`[SELECTOR] ✅ &quot;${label}&quot; MATCHED candidate #${i + 1}`);<br>      return el;<br>    }<br>    console.warn(`[SELECTOR] ❌ &quot;${label}&quot; FAILED candidate #${i + 1}`);<br>  }<br>  console.warn(`[SELECTOR] 🚫 &quot;${label}&quot; — ALL candidates failed`);<br>  return null;<br>}</pre><p>This one pattern is, honestly, the single most valuable piece of the codebase — it’s what makes the extension <em>maintainable</em> instead of something that quietly dies the next time Facebook redesigns a component.</p><h3>Problem #2: Comment Boxes Load Dynamically</h3><p>Facebook is a single-page app — comment boxes appear and disappear as you scroll, open dialogs, or expand replies. A one-time querySelectorAll on page load would miss almost everything.</p><p>The solution is a <strong>MutationObserver</strong> watching the whole document, debounced so it doesn’t fire hundreds of times a second, plus a backup interval as a safety net:</p><pre>start() {<br>  const debounced = Utils.debounce(() =&gt; this.scan(), 200);<br>  this._observer = new MutationObserver(debounced);<br>  this._observer.observe(document.body, { childList: true, subtree: true });<br>  this._backupTimer = setInterval(() =&gt; this.scan(), 1200);<br>}</pre><p>Every scan checks which comment editors are new (marked with a data-ai-mutated attribute once handled) so the button never gets injected twice into the same box.</p><h3>Problem #3: Getting the AI to Reply in the Right Language</h3><p>Early tests kept producing English replies on Bengali posts, or Bengali written in Roman letters (“kemon acho”) instead of the actual script. This is a real problem for a Bangladesh-based audience.</p><p>The fix was a strict system prompt plus a runtime language check:</p><pre>PROMPT: `You are writing a reply to a Facebook post/comment.<br>CRITICAL LANGUAGE RULE: Reply in EXACTLY the same language AND the same<br>script/alphabet as the original text. If the original is Bengali/Bangla,<br>you MUST write your reply in Bengali script (বাংলা) — never Arabic script,<br>never Roman transliteration, never English.<br>TONE: Match the original tone. Sound human and natural, not like a bot.<br>No hashtags. Keep it short (1-3 sentences) and add genuine value.`</pre><p>And when the extractor detects Bengali characters in the source post, it appends an extra explicit instruction on top of the system prompt — belt and suspenders:</p><pre>if (script === &#39;bengali&#39;) {<br>  prompt += `\nLANGUAGE REQUIREMENT: The original text is Bengali (Bangla).<br>  Your reply MUST be written in Bengali script (বাংলা).`;<br>}</pre><p>Redundant instructions like this feel unnecessary until you’re debugging why a model <em>occasionally</em> ignores the first one.</p><h3>Problem #4: Writing Text Into Facebook’s Editor Without Breaking It</h3><p>This was the hardest part. Facebook’s comment box isn’t a plain &lt;textarea&gt; — it&#39;s a <strong>Lexical editor</strong> (Meta&#39;s own rich-text framework), and directly setting innerText or innerHTML on it often leaves Facebook&#39;s internal state out of sync, causing duplicated text, broken formatting, or a box that <em>looks</em> empty but silently contains hidden content.</p><p>The EditorHandler uses a layered strategy: try the safest method first, verify it worked, and fall back if not.</p><pre>async insertText(editor, text) {<br>  editor.focus();<br>  this._selectAll(editor);<br>  let success = document.execCommand(&#39;insertText&#39;, false, text);<br>  await this._wait(200);</pre><pre>  if (!this._verify(editor, text, &#39;execCommand&#39;)) {<br>    success = await this._pasteFallback(editor, text);<br>  }<br>  this._scheduleDuplicationGuard(editor, text);<br>  return success;<br>}</pre><p>And because occasionally text would get inserted <em>twice</em> (once by the primary method, once by a retry), there’s a delayed <strong>duplication guard</strong> that re-checks the box 800ms later and repairs it if needed:</p><pre>_scheduleDuplicationGuard(editor, text) {<br>  setTimeout(async () =&gt; {<br>    const copies = this._count(editor, text);<br>    if (copies &lt;= 1) return; // fine<br>    console.warn(`🧹 text appears ${copies}× — REPAIRING to a single copy`);<br>    // select-all, re-insert, and if that fails, rebuild the DOM directly<br>  }, 800);<br>}</pre><p>This kind of defensive, multi-layer approach is honestly what separates “works on my machine” from “works reliably for thousands of users on a platform I don’t control.”</p><h3>Multi-Provider AI With Automatic Model Fallback</h3><p>Rather than locking users into one AI provider, the extension supports <strong>OpenAI, Groq, and Gemini</strong>, with a priority-ordered model list per provider (fastest/cheapest models first) and a hardcoded fallback list in case the live model list can’t be fetched:</p><pre>MODEL_PRIORITY: {<br>  groq: [&#39;llama-3.3-70b-versatile&#39;, &#39;llama-3.1-8b-instant&#39;, ...],<br>  gemini: [&#39;gemini-flash-lite-latest&#39;, &#39;gemini-2.5-flash-lite&#39;, ...],<br>  openai: [&#39;gpt-4o-mini&#39;, &#39;gpt-4.1-mini&#39;, &#39;gpt-4.1-nano&#39;],<br>},<br>FALLBACK_MODELS: {<br>  groq: [&#39;llama-3.3-70b-versatile&#39;, &#39;llama-3.1-8b-instant&#39;, ...],<br>  ...<br>}</pre><p>It also filters out non-chat models (Whisper, TTS, embeddings, moderation endpoints) automatically using a regex, so it never accidentally tries to “chat” with an audio transcription model:</p><pre>NON_CHAT_PATTERNS: /whisper|orpheus|tts|stt|speech|audio|embed|moderation/i</pre><h3>The Free Daily Limit (and Why It’s Honest)</h3><p>The Lite version includes <strong>10 free AI comments per day</strong>, tracked locally:</p><pre>async checkAndCountUsage() {<br>  const today = new Date().toISOString().slice(0, 10);<br>  const { usageDate, usageCount = 0 } = await chrome.storage.local.get([&#39;usageDate&#39;, &#39;usageCount&#39;]);<br>  const count = usageDate === today ? usageCount : 0;<br>  await chrome.storage.local.set({ usageDate: today, usageCount: count + 1 });<br>  return count + 1;<br>}</pre><p>Nothing is sent to any server to enforce this — it’s entirely local chrome.storage, which also means your API keys never touch anything except the AI provider you chose. When the limit is hit, a small dismissible banner appears with an upgrade link — pointing to a <strong>bKash/Nagad checkout for Bangladeshi users</strong> or <strong>Gumroad for everyone else</strong>, detected from a country setting saved in the popup.</p><h3>Debugging: Every Action Is Logged</h3><p>Every step — scanning, selector matching, button injection, API calls, text insertion — logs to the browser console with a consistent tag, [AI FB Comment], and a sub-tag like [SCAN], [SELECTOR], [AI], or [INSERT]. Opening DevTools (F12) turns a &quot;why isn&#39;t this working&quot; moment into a two-second diagnosis:</p><pre>[AI FB Comment] [SCAN] 1 comment editor(s) in DOM, 1 new one(s) need the AI button<br>[AI FB Comment] [SELECTOR] ✅ &quot;commentEditor&quot; MATCHED candidate #1<br>[AI FB Comment] [UI] ✅ Button attached to toolbar<br>[AI FB Comment] [AI] ➤ Calling groq/llama-3.3-70b-versatile<br>[AI FB Comment] [INSERT] ✅ execCommand: verified exactly 1 copy in the box</pre><p>This logging-first mindset is something I’d recommend for <em>any</em> browser extension or scraper — you’re building on a platform you don’t control, so assume it will change and give yourself the tools to find out why, fast.</p><h3>Try It Yourself</h3><p>The Lite version is completely free — 10 AI comments/day, all three providers supported, full source code included.</p><ul><li><strong>Get the extension (Gumroad):</strong> <a href="https://mohammadtanvir.gumroad.com/l/ai-facebook-comment-generator-lite">https://mohammadtanvir.gumroad.com/l/ai-facebook-comment-generator-lite</a></li><li><strong>Need unlimited comments + AI Post Generator?</strong> Check out the Pro version: <a href="https://mohammadtanvir.gumroad.com/l/ai-facebook-comment-post-generator-pro">https://mohammadtanvir.gumroad.com/l/ai-facebook-comment-post-generator-pro</a></li><li><strong>Free source code:</strong> <a href="https://github.com/seotanvirbd">https://github.com/seotanvirbd</a></li><li><strong>Video walkthrough (install + demo, English &amp; Bangla):</strong> <a href="https://www.youtube.com/@tanvirbinali2200">https://www.youtube.com/@tanvirbinali2200</a></li></ul><p>If you’re building something similar — a browser extension, a scraper, or any AI-integrated tool — and want to talk through the architecture, I’m available for freelance work on Upwork.</p><p><em>Tanvir is a Python &amp; AI automation freelancer building browser extensions, scrapers, and AI-integrated tools.</em></p><ul><li>🌐 Website: <a href="https://seotanvirbd.com/">https://seotanvirbd.com/</a></li><li>💼 Upwork: <a href="https://www.upwork.com/freelancers/~010fc1db7bfe386976">https://www.upwork.com/freelancers/~010fc1db7bfe386976</a></li><li>💻 GitHub: <a href="https://github.com/seotanvirbd">https://github.com/seotanvirbd</a></li><li>🔗 LinkedIn: <a href="https://www.linkedin.com/in/seotanvirbd/">https://www.linkedin.com/in/seotanvirbd/</a></li><li>📺 YouTube: <a href="https://www.youtube.com/@tanvirbinali2200">https://www.youtube.com/@tanvirbinali2200</a></li></ul><p>If this was useful, follow for more breakdowns of real, working AI automation projects — not just theory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e51c9a8447b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built a Free AI Chrome Extension for LinkedIn — Full Code Walkthrough]]></title>
            <link>https://medium.com/@seotanvirbd/how-i-built-a-free-ai-chrome-extension-for-linkedin-full-code-walkthrough-48349546066e?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/48349546066e</guid>
            <category><![CDATA[linkedin-marketing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[linkedin-automation]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[lead-generation]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Tue, 04 Aug 2026 15:45:30 GMT</pubDate>
            <atom:updated>2026-08-04T17:43:22.741Z</atom:updated>
            <content:encoded><![CDATA[<p>A practical breakdown of the architecture, the key code, and how to build your own — the Lite version is 100% free and open-source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cz2BQUYYWghulhUslU9OZg.png" /></figure><p>A while back I shared how I built an AI-powered LinkedIn extension (<a href="https://medium.com/@seotanvirbd/how-i-built-an-ai-powered-linkedin-extension-that-writes-posts-and-comments-for-you-full-9e0d00d2fc62?postPublishedType=repub">full breakdown here</a>). That post focused on the Pro version. This one is different: it’s the free Lite version, fully open-source, and I’m walking through the actual code so you can either use it as-is or learn how to build something similar yourself.</p><p>No paywall on the code here. If this is useful, a star on GitHub or a follow goes a long way.</p><p><strong>Get the free extension:</strong> <a href="https://mohammadtanvir.gumroad.com/l/linkedin-comment-generator">Gumroad — AI LinkedIn Comment Generator (Lite)</a></p><h3>Why I Built This</h3><p>Writing a genuine, context-aware LinkedIn comment takes real time — read the post, understand what the author is saying, write something that isn’t generic. As a freelancer trying to stay visible on LinkedIn, I needed this automated without giving up control of my API key or my data to some SaaS dashboard.</p><p>So the extension calls the AI provider directly from your browser, using your own API key. No backend, no data logging, nothing to trust but the code — which you can read below.</p><h3>What It Does</h3><p>A Chrome Manifest V3 content script that injects one thing into LinkedIn’s interface: an <strong>“AI Suggestion” button</strong> inside every comment box. Click it, and it reads the post’s context and drafts a reply right there — no tab-switching, no copy-paste.</p><h3>Architecture: Five Modules, One Job Each</h3><p><strong>Scanner</strong> — Watches the LinkedIn DOM with a MutationObserver (plus a backup polling interval) and detects new comment boxes as you scroll an infinite feed.</p><p><strong>DomExtractor</strong> — Pulls the original post’s author and text, plus any parent comment if you’re replying to a reply, to give the AI real context instead of nothing to work with.</p><p><strong>AIService</strong> — Builds and sends the request to your selected provider (OpenAI, Groq, or Gemini), discovers available models automatically, and falls back gracefully if one is deprecated or rate-limited.</p><p><strong>EditorHandler</strong> — Inserts the generated reply into LinkedIn’s editor using a three-tier fallback strategy, because LinkedIn’s editor framework is fragile and undocumented.</p><p><strong>UIInjector</strong> — Creates the AI Suggestion button and attaches it to LinkedIn’s comment toolbar.</p><h3>The Code That Actually Matters</h3><h3>1. Selectors that survive LinkedIn’s constant UI changes</h3><p>LinkedIn changes its HTML structure often, without warning — this is the #1 reason automation scripts break. The fix is a fallback-array pattern instead of one hardcoded selector:</p><pre>SELECTORS: {<br>  commentBox: [&#39;[componentkey^=&quot;commentBox-&quot;]&#39;,<br>               &#39;[data-testid=&quot;comment-box&quot;]&#39;, &#39;.comment-box&#39;],<br>  commentEditor: [&#39;[contenteditable=&quot;true&quot;][role=&quot;textbox&quot;]&#39;,<br>                   &#39;.ProseMirror&#39;, &#39;textarea&#39;],<br>  // ...<br>}</pre><pre>findElements(container, selectors, context, single = true) {<br>  for (const sel of selectors) {<br>    const found = single<br>      ? container.querySelector(sel)<br>      : Array.from(container.querySelectorAll(sel));<br>    if (found) { log(`Selector &quot;${sel}&quot; matched in ${context}`); return found; }<br>  }<br>  log(`No selectors matched in ${context}`);<br>}</pre><p>Each element type has an array of selectors, tried newest-first. When LinkedIn ships a UI update and something breaks, the console log tells you exactly which array needs a new entry — instead of a silent failure.</p><h3>2. Talking to the AI, with real fallbacks</h3><p>The extension tries multiple models per provider until one actually works, instead of failing the moment one model is overloaded or deprecated:</p><pre>for (const model of models) {<br>  try {<br>    const data = await Utils.safeFetch(url, {<br>      method: &#39;POST&#39;, headers, body: JSON.stringify(body)<br>    }, `Call ${model}`);<br>    if (!data) continue;   // try next model</pre><pre>    const content = isOpenAICompatible<br>      ? data?.choices?.[0]?.message?.content<br>      : data?.candidates?.[0]?.content?.parts?.[0]?.text;</pre><pre>    if (content?.trim()) {<br>      return Utils.removeEmojis(Utils.stripMarkdown(content.trim()));<br>    }<br>  } catch (err) {<br>    log(`Error with model ${model}:`, err.message);<br>  }<br>}</pre><p>Available models are fetched dynamically from each provider’s /models endpoint, with a hardcoded fallback list if that request fails. The extension keeps working even after a provider retires an old model.</p><h3>3. Inserting text into an editor that fights you</h3><p>Modern web apps (LinkedIn’s editor is React + a custom rich-text layer) intercept normal DOM manipulation. One insertion method will eventually fail on some browser or LinkedIn version, so there are three, tried in order:</p><pre>// Strategy 1: simulate a real clipboard paste (most reliable)<br>editor.dispatchEvent(new ClipboardEvent(&#39;paste&#39;, { clipboardData: dt, ... }));<br>success = !!editor.textContent.trim();</pre><pre>// Strategy 2: execCommand insertHTML (deprecated but widely supported)<br>if (!success) {<br>  document.execCommand(&#39;insertHTML&#39;, false, htmlContent);<br>}</pre><pre>// Strategy 3: direct innerHTML (last resort)<br>if (!success) {<br>  editor.innerHTML = text.split(&#39;\n&#39;).map(l =&gt; `&lt;p&gt;${l}&lt;/p&gt;`).join(&#39;&#39;);<br>}</pre><pre>// Tell React the content changed<br>editor.dispatchEvent(new InputEvent(&#39;input&#39;, { bubbles: true, ... }));</pre><p>Without that last line, the text appears but LinkedIn’s own Post/Comment button can stay disabled — the framework never “sees” the change.</p><h3>Build Your Own: The Short Version</h3><ol><li><strong>Manifest V3</strong> — declare content_scripts for your target site, storage permission, and host_permissions for whichever AI provider APIs you&#39;ll call.</li><li><strong>Fallback selectors, not single ones</strong> — array per element, newest first, log what matched.</li><li><strong>Watch the DOM with a debounced MutationObserver</strong>, plus a backup setInterval as a safety net.</li><li><strong>Extract real context before prompting</strong> — a generic prompt produces obviously-AI, low-value output.</li><li><strong>Support multiple AI providers with fallback models</strong> — removes vendor lock-in, lets users use free tiers.</li><li><strong>Insert text with a tiered strategy</strong>, and always dispatch input/change events afterward.</li><li><strong>Log everything through one function</strong> that captures the calling function and line number — saves hours once real users hit edge cases you didn’t test.</li></ol><h3>Get the Free Extension</h3><p>Full source code, no paywall:</p><p><strong>🎥 Full video walkthrough:</strong> <a href="https://www.youtube.com/watch?v=onQ6RfyVgqw">youtube.com/watch?v=onQ6RfyVgqw</a></p><p><strong>⬇️ Free Lite version:</strong> <a href="https://mohammadtanvir.gumroad.com/l/linkedin-comment-generator">Gumroad — AI LinkedIn Comment Generator (Lite)</a></p><p>If you outgrow the Lite version’s daily comment limit and want unlimited comments plus one-click AI post generation, I also built a Pro version — here’s <a href="https://medium.com/@seotanvirbd/how-i-built-an-ai-powered-linkedin-extension-that-writes-posts-and-comments-for-you-full-9e0d00d2fc62?postPublishedType=repub">the full breakdown of what’s different.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4BdT3p_LjL3MNJuG-1fpEA.gif" /></figure><p><em>I write about Python automation, web scraping, and practical AI tooling for freelancers and creators.</em></p><p>🌐 Portfolio: <a href="https://seotanvirbd.com/">seotanvirbd.com</a> 💼 Upwork: <a href="https://www.upwork.com/freelancers/~010fc1db7bfe386976">upwork.com/freelancers/~010fc1db7bfe386976</a> 🔗 LinkedIn: <a href="https://www.linkedin.com/in/seotanvirbd/">linkedin.com/in/seotanvirbd</a> 💻 GitHub: <a href="https://github.com/seotanvirbd">github.com/seotanvirbd</a></p><p>Questions about the code before you build your own? Drop a comment — happy to walk through any part of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48349546066e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built an AI-Powered LinkedIn Extension That Writes Posts and Comments For You (Full…]]></title>
            <link>https://medium.com/@seotanvirbd/how-i-built-an-ai-powered-linkedin-extension-that-writes-posts-and-comments-for-you-full-9e0d00d2fc62?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e0d00d2fc62</guid>
            <category><![CDATA[linkedin-automation]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[linkedin-marketing]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 18:52:23 GMT</pubDate>
            <atom:updated>2026-08-04T15:48:21.037Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Built an AI-Powered LinkedIn Extension That Writes Posts and Comments For You (Full Breakdown)</h3><p>Most “AI LinkedIn tools” ask you to trust a black box — you paste your content into someone else’s website, pay a monthly fee, and hope your data isn’t being logged somewhere. I wanted to build something different: a tool where you can see exactly how it works, control your own API key, and never send your data through a third-party server you don’t own.</p><p>Here’s the complete breakdown of what I built, how it works under the hood, and why it’s safe to trust with your LinkedIn activity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4BdT3p_LjL3MNJuG-1fpEA.gif" /></figure><h3>The Problem</h3><p>If you’re serious about LinkedIn, you know consistency is everything — regular posts, thoughtful comments, real engagement. But writing all of that manually, every day, is exhausting. Most people either burn out or go quiet after a few weeks.</p><p>AI can clearly help here. The problem is <em>how</em> most tools implement it: subscription paywalls, content routed through unknown servers, and zero visibility into what’s actually happening with your data.</p><h3>What I Built</h3><p>A Chrome extension (Manifest V3) that injects two things directly into LinkedIn’s interface:</p><ol><li>An <strong>“AI Suggestion” button</strong> inside every comment box</li><li>An <strong>“AI Post” button</strong> inside the post composer</li></ol><p>Click either one, and it generates ready-to-use text right where you’re already working — no switching tabs, no copy-pasting.</p><h3>The Architecture (For Anyone Who Wants to Verify This Themselves)</h3><p>The extension is built around four core components:</p><p><strong>Scanner</strong> — Continuously watches LinkedIn’s page using a MutationObserver, with a backup polling interval as a fallback. LinkedIn frequently changes its DOM structure, so this component uses layered CSS selector fallbacks (including support for LinkedIn&#39;s shadow-DOM post editor) to keep finding the right places to inject buttons, even after LinkedIn ships UI updates.</p><p><strong>DomExtractor</strong> — When you click “AI Suggestion” on a comment, this pulls the original post’s author and text, plus the parent comment if you’re replying to a reply. This context is what makes the generated reply relevant instead of generic.</p><p><strong>AIService</strong> — Sends the extracted context to your selected provider’s chat-completion endpoint (OpenAI, Groq, or Gemini). It tries multiple models with sensible fallbacks if a request fails, and strips stray Markdown syntax before returning clean, plain text.</p><p><strong>EditorHandler</strong> — Inserts the generated text into LinkedIn’s rich-text editor using a three-tier strategy: clipboard paste → execCommand → direct innerHTML. This layered approach exists because LinkedIn&#39;s editor is notoriously inconsistent about accepting programmatic text insertion — this makes sure it works reliably.</p><h3>Where Your Data Actually Goes</h3><p>This is the part that matters most for trust, so I’ll be direct:</p><ul><li>Your API key is stored using chrome.storage.local — <strong>on your device, in your browser only.</strong></li><li>When you click Generate, the extracted post/comment text is sent <strong>directly from your browser to the AI provider you selected</strong> (OpenAI, Groq, or Gemini) — using your API key, authenticated as you.</li><li>Nothing passes through my servers. I don’t have a backend collecting your content, your API key, or your usage. There’s no server to breach because there isn’t one in the data path.</li></ul><p>You can verify all of this yourself — the full source is included when you purchase, so nothing is hidden behind minified or obfuscated code you can’t inspect.</p><h3>Why I Chose OpenAI, Groq, and Gemini</h3><ul><li><strong>OpenAI (GPT-4o-mini)</strong> — high-quality output, low cost per request.</li><li><strong>Groq (free tier)</strong> — genuinely free, extremely fast inference (llama-3.3–70b, llama-3.1–8b, and others).</li><li><strong>Google Gemini (free tier)</strong> — another solid free option with generous limits.</li></ul><p>You’re not locked into one provider or one price. If Groq’s free tier is enough for your usage, you pay nothing per generation — the extension itself is a one-time purchase, not a subscription.</p><h3>What’s Included When You Buy</h3><ul><li>Full extension source code (manifest.json, content.js, popup.js, popup.html)</li><li>A <strong>User Guideline</strong> — step-by-step installation and setup instructions for non-technical buyers</li><li>A <strong>Developer Guideline</strong> — for anyone who wants to customize selectors, add a new AI provider, or adjust prompt behavior</li><li>Lifetime updates for this version</li><li>Direct email support if you run into installation issues</li></ul><h3>Who This Is Actually For</h3><ul><li>Freelancers and consultants who need to stay visible on LinkedIn but don’t have hours to spend writing</li><li>Founders and marketers managing their own personal brand alongside everything else</li><li>Anyone tired of staring at a blank comment box trying to think of something worth saying</li></ul><h3>A Quick Honest Note</h3><p>This tool automates content generation on LinkedIn. It’s an independent, unofficial project — not affiliated with LinkedIn or any AI provider. Use it responsibly and within LinkedIn’s Terms of Service; like any automation tool, excessive or careless use carries some account risk. I’d rather be upfront about that than oversell it.</p><h3>Get It</h3><p>If this solves a real problem for you, you can grab the full extension here:</p><p><strong>👉 </strong><a href="https://mohammadtanvir.gumroad.com/l/yhxkvp"><strong>AI LinkedIn Post &amp; Comment Generator (Pro) — Gumroad</strong></a></p><p>Want to see the code first? The Lite version is free and fully open-source — <a href="https://medium.com/@seotanvirbd/how-i-built-a-free-ai-chrome-extension-for-linkedin-full-code-walkthrough-48349546066e?postPublishedType=initial">[The Lite version is 100% free and open-source]</a>.</p><p>And if you want to see more of what I build — Python automation, web scraping, and AI tooling — here’s where to find me:</p><ul><li>🌐 Portfolio: <a href="https://seotanvirbd.com/">seotanvirbd.com</a></li><li>💼 Hire me on Upwork: <a href="https://www.upwork.com/freelancers/~010fc1db7bfe386976">upwork.com/freelancers/~010fc1db7bfe386976</a></li><li>🔗 LinkedIn: <a href="https://www.linkedin.com/in/seotanvirbd/">linkedin.com/in/seotanvirbd</a></li><li>💻 GitHub: <a href="https://github.com/seotanvirbd">github.com/seotanvirbd</a></li><li>🎥 YouTube tutorials: <a href="https://www.youtube.com/@tanvirbinali2200">@tanvirbinali2200</a></li></ul><p>Questions about how it works before buying? Drop a comment — I’m happy to walk through any part of it.</p><p><em>I write about Python automation, web scraping, and practical AI tooling for freelancers and creators. Follow along on </em><a href="https://medium.com/@seotanvirbd"><em>Medium</em></a><em> for more breakdowns like this.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e0d00d2fc62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built a Free AI Chrome Extension That Writes LinkedIn Comments For You (Full Tutorial + Source…]]></title>
            <link>https://medium.com/@seotanvirbd/i-built-a-free-ai-chrome-extension-that-writes-linkedin-comments-for-you-full-tutorial-source-1bf3c4018861?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1bf3c4018861</guid>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 18:49:42 GMT</pubDate>
            <atom:updated>2026-07-21T18:49:42.901Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Built a Free AI Chrome Extension That Writes LinkedIn Comments For You (Full Tutorial + Source Code)</h3><p><em>How I built an AI-powered LinkedIn Comment Generator from scratch — and how you can build your own, or just install mine for free.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*agWktSgiwL6fBGPcFLFbGw.png" /><figcaption>Linkedin Comment Generator Chrome Extension</figcaption></figure><p>If you’re active on LinkedIn, you already know the grind: you want to engage with your network’s posts, but writing a thoughtful comment every single time takes real effort. Multiply that by 20–30 posts a day, and engagement quietly becomes a chore you skip.</p><p>So I built a Chrome extension that solves this with one click.</p><h3>What I Built</h3><p><strong>AI LinkedIn Comment Generator</strong> is a lightweight Chrome extension that adds a single “AI Suggestion” button directly inside LinkedIn’s comment box. Click it, and it reads the post’s content and author context, then generates a natural, relevant comment instantly — using your own free API key from <strong>OpenAI</strong>, <strong>Groq</strong>, or <strong>Google Gemini</strong>.</p><p>No subscriptions. No hidden servers. Your API key stays local in your browser and talks only to the AI provider you choose.</p><h3>Watch the Full Build (Free, 1-Hour Tutorial)</h3><p>I recorded a complete 1-hour walkthrough on my YouTube channel covering:</p><ul><li>Creating a basic Chrome extension from scratch using Google’s official developer docs</li><li>The full architecture of this LinkedIn Comment Generator project</li><li>Writing and explaining the actual code (manifest, content script, popup)</li><li>Debugging common extension errors</li><li>How the script detects and selects elements on the LinkedIn DOM</li><li>How to keep the extension working despite LinkedIn’s frequent UI changes</li></ul><p><a href="https://www.youtube.com/watch?v=onQ6RfyVgqw"><strong>▶ Watch the tutorial here</strong></a></p><p><a href="https://www.youtube.com/watch?v=onQ6RfyVgqw?si=UWK7We2L4pV6jVRp">- YouTube</a></p><p>Whether you want to just use the tool or learn to build your own AI Chrome extensions, this video walks through everything end-to-end in plain language.</p><h3>Get the Extension (Free)</h3><p>The Lite version is free to download and includes full source code, so you can install it as-is or study it as a learning project.</p><p><a href="https://mohammadtanvir.gumroad.com/l/linkedin-comment-generator"><strong>Download on Gumroad →</strong></a> <a href="https://seotanvirbd.com/product/ai-linkedin-comment-generator-free-chrome-extension-openai-gemini-groq/"><strong>Download from my website →</strong></a></p><h3>What’s included:</h3><ul><li>Full source code (manifest.json, content.js, popup.html, popup.js, icon.png)</li><li>Step-by-step Quick Start Guide (PDF)</li><li>Support for OpenAI, Groq (free tier), and Google Gemini (free tier)</li></ul><h3>Why I Built It This Way</h3><p>Most “AI for LinkedIn” tools online are paid SaaS products that store your data on someone else’s server. I wanted something transparent: open code, your own API key, zero recurring cost. That’s the Lite version.</p><p>For creators and freelancers who also want to <em>generate full posts</em> (not just comments), I built a <strong>Premium version</strong> with an “AI Post” button — draft a complete LinkedIn post with hook and hashtags from just a topic. If that’s useful to you, check the Gumroad page for pricing.</p><h3>Who This Is For</h3><ul><li>Freelancers and creators trying to stay consistent on LinkedIn without burning hours</li><li>Developers who want a real, working Chrome extension project to learn from</li><li>Anyone curious how AI + browser automation actually works under the hood</li></ul><h3>Final Thoughts</h3><p>This project started as something I needed for myself — I was spending too long crafting comments and not enough time on actual client work. If it saves you time too, that’s a win. And if you’re learning to code, the tutorial breaks down every decision I made, including the mistakes and fixes along the way.</p><p>Try it, break it, improve it — and let me know what you build with it.</p><p><em>Follow me for more Python, AI automation, and Chrome extension projects: </em><a href="https://claude.ai/chat/YOUR_YOUTUBE_LINK"><em>YouTube</em></a><em> | </em><a href="https://seotanvirbd.com/"><em>seotanvirbd.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf3c4018861" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Site Scraping — Full Pipeline]]></title>
            <link>https://medium.com/@seotanvirbd/javascript-site-scraping-full-pipeline-a0ec50c0674b?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0ec50c0674b</guid>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 17:06:00 GMT</pubDate>
            <atom:updated>2026-03-25T17:06:00.276Z</atom:updated>
            <content:encoded><![CDATA[<p>বেশিরভাগ ডেভেলপার মনে করেন web scraping মানে curl + regex।<br>কিন্তু আজকের ৮০% আধুনিক সাইটে এই ধারণা কাজ করে না। 🕸️</p><p>JavaScript সব কিছু বদলে দিয়েছে। এখন পেজ render হয় browser-এ, server-এ নয়।<br>শুধু raw HTML fetch করলে অর্ধেক data-ই মিস হয়।</p><p>এখানে পুরো JS scraping pipeline টা দেওয়া হলো:</p><p>1️⃣ Static সাইট → fetch() বা axios ব্যবহার করুন<br> দ্রুত, হালকা, কোনো browser overhead নেই।<br> যদি data প্রাথমিক HTML response-এ থাকে, এটাই যথেষ্ট।</p><p>2️⃣ Dynamic JS-rendered সাইট → Puppeteer বা Playwright<br> একটি real headless Chromium চালু করে।<br> JavaScript execute হওয়ার পর data extract করে।</p><p>3️⃣ Parse ও Extract → Cheerio (server-side jQuery) অথবা querySelector<br> CSS selector: document.querySelectorAll(‘.product-price’)<br> Cheerio: $(‘h2.title’).text()</p><p>4️⃣ সাবধান থাকুন anti-bot defence নিয়ে:<br> — Rate limit (429 Too Many Requests)<br> — CAPTCHA যা headless browser আটকে দেয়<br> — robots.txt — সবার আগে এটা চেক করুন<br> — JS-এ embedded dynamic token<br> — Terms of Service-এর বিধিনিষেধ</p><p>5️⃣ Output → JSON, CSV, অথবা সরাসরি database-এ</p><p>সহজ নিয়ম:<br>→ Data কি HTML source-এ আছে? fetch + Cheerio ব্যবহার করুন।<br>→ Data কি click/scroll-এর পর load হয়? Playwright ব্যবহার করুন।</p><p>Tools গুলো বিনামূল্যে পাওয়া যায়। কোনটা কখন ব্যবহার করতে হবে সেটা জানাই একটি কার্যকর scraper আর একটি ব্যর্থ scraper-এর পার্থক্য।</p><p>আপনি JS scraping-এ কোন সমস্যায় পড়েছেন সম্প্রতি? 👇</p><p>#WebScraping #JavaScript #Puppeteer #Playwright #NodeJS</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0ec50c0674b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built a Google Maps Scraper That Extracts 20+ Data Fields in Minutes (And How You Can Too)]]></title>
            <link>https://medium.com/@seotanvirbd/how-i-built-a-google-maps-scraper-that-extracts-20-data-fields-in-minutes-and-how-you-can-too-5c826eeee184?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c826eeee184</guid>
            <category><![CDATA[lead-generation]]></category>
            <category><![CDATA[google-maps]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Fri, 21 Nov 2025 13:10:47 GMT</pubDate>
            <atom:updated>2025-11-21T13:10:47.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*885MeP6QiOLZvDXWPCnK3g.png" /></figure><p><strong>Published:</strong> November 2024 | <strong>Reading Time:</strong> 8 minutes | <strong>Category:</strong> Data Automation, Python, Web Scraping</p><h3>The Problem That Started It All</h3><p>Picture this: You’re a market researcher trying to analyze restaurant trends in New York City. You need data on 100+ restaurants — their ratings, prices, contact info, service options, and more.</p><p>Your options?</p><ol><li><strong>Manual copy-paste</strong>: 5–10 minutes per restaurant = 8–16 hours of mind-numbing work</li><li><strong>Hire a VA</strong>: $200–500 for the project</li><li><strong>Use expensive data APIs</strong>: $100–500/month subscriptions</li></ol><p>There had to be a better way.</p><p>That’s when I decided to build a <strong>Google Maps scraper</strong> that could extract comprehensive restaurant data automatically and export it to clean Excel files. What started as a weekend project turned into a powerful tool that saves hours of manual work.</p><h3>What Makes This Scraper Different?</h3><p>Most Google Maps scrapers out there are basic — they grab surface-level data like names and ratings. But real business intelligence requires depth.</p><p>This scraper uses a <strong>two-stage extraction system</strong>:</p><h3>Stage 1: The Wide Net</h3><p>First, it casts a wide net across Google Maps search results:</p><ul><li>Scrolls through all available results (not just the first page)</li><li>Collects basic info: names, ratings, review counts</li><li>Most importantly: <strong>captures every restaurant’s unique URL</strong></li></ul><h3>Stage 2: The Deep Dive</h3><p>Then comes the magic. For each URL collected, the scraper:</p><ul><li>Visits the restaurant’s detailed Google Maps page</li><li>Extracts 20+ data fields</li><li>Handles missing information gracefully</li><li>Compiles everything into a structured dataset</li></ul><p>The result? A comprehensive Excel file with everything you need for analysis, outreach, or competitive research.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RwZLLVKHyPDHhv3hX4cGfQ.png" /></figure><h3>The Data Goldmine: 20+ Fields Extracted</h3><p>Here’s what the scraper captures from each restaurant:</p><p><strong>🎯 Core Metrics</strong></p><ul><li>Restaurant name</li><li>Star rating (1–5)</li><li>Total review count</li><li>Price range ($, $$, $$$, $$$$)</li><li>Cuisine type</li></ul><p><strong>📞 Contact &amp; Location</strong></p><ul><li>Complete address</li><li>Phone number</li><li>Official website</li><li>Google Plus Code</li><li>Direct Google Maps URL</li></ul><p><strong>⏰ Operational Details</strong></p><ul><li>Current status (Open/Closed)</li><li>Hours of operation</li><li>Service options (Dine-in, Takeout, Delivery)</li></ul><p><strong>🔗 Digital Presence</strong></p><ul><li>Menu link</li><li>Reservation link</li><li>Recent review snippets</li><li>Popular times availability</li></ul><p><strong>♿ Additional Information</strong></p><ul><li>Accessibility features</li><li>Full restaurant description</li></ul><p>This isn’t just data — it’s <strong>actionable business intelligence</strong>.</p><h3>Real-World Use Cases</h3><h3>1. Market Research &amp; Competitive Analysis</h3><p>A restaurant owner in Chicago used this scraper to analyze 200+ pizza places in the city. Within 30 minutes, they had:</p><ul><li>Average ratings by neighborhood</li><li>Price distribution analysis</li><li>Service options comparison</li><li>Website adoption rates</li></ul><p><strong>Result:</strong> Identified an underserved neighborhood with high demand but few delivery options.</p><h3>2. Lead Generation for B2B Services</h3><p>A web design agency scraped 500 restaurants in their city and filtered for:</p><ul><li>Businesses with 4+ star ratings (successful, worth investing in marketing)</li><li>Missing websites or outdated menu links</li><li>Phone numbers for direct outreach</li></ul><p><strong>Result:</strong> Generated 150 qualified leads in one afternoon.</p><h3>3. Investment &amp; Location Analysis</h3><p>A commercial real estate investor used the scraper to:</p><ul><li>Map restaurant density by neighborhood</li><li>Identify cuisine gaps in emerging areas</li><li>Analyze price points vs. location demographics</li></ul><p><strong>Result:</strong> Made data-driven decisions on property investments.</p><h3>4. Academic Research</h3><p>Urban planning researchers used the tool to study:</p><ul><li>Restaurant distribution patterns</li><li>Correlation between ratings and price points</li><li>Service option adoption rates post-pandemic</li></ul><p><strong>Result:</strong> Published findings on urban food accessibility.</p><h3>Technical Deep Dive: How It Works</h3><h3>The Architecture</h3><pre>User Input (Search Query)<br>    ↓<br>Language Detection (13+ languages)<br>    ↓<br>Stage 1: Scroll &amp; Collect URLs<br>    ↓<br>Stage 2: Visit Each URL<br>    ↓<br>Extract 20+ Data Fields<br>    ↓<br>Export to Excel</pre><h3>Key Technical Features</h3><p><strong>1. Smart Scrolling Algorithm</strong> Google Maps loads results dynamically as you scroll. The scraper:</p><ul><li>Detects the scrollable container</li><li>Scrolls incrementally</li><li>Checks for new content after each scroll</li><li>Stops when no new results appear (with 3-attempt verification)</li></ul><p><strong>2. Multi-Language Support</strong> The scraper automatically detects location and sets the appropriate language:</p><ul><li>“restaurants in tokyo” → Japanese (ja-JP)</li><li>“cafes in paris” → French (fr-FR)</li><li>“pizza in new york” → English (en-US)</li></ul><p>This ensures accurate data extraction regardless of location.</p><p><strong>3. Robust Error Handling</strong> Not all restaurants have complete information. The scraper:</p><ul><li>Uses try-catch blocks for each data field</li><li>Records “N/A” for missing data instead of crashing</li><li>Logs errors for debugging</li><li>Continues scraping even if one listing fails</li></ul><p><strong>4. Anti-Detection Measures</strong> To avoid being blocked:</p><ul><li>Disables automation flags</li><li>Adds natural delays between requests (2–3 seconds)</li><li>Mimics human browsing patterns</li><li>Uses proper user agents</li></ul><h3>The Technology Stack</h3><ul><li><strong>Python 3.7+</strong>: Core programming language</li><li><strong>Selenium WebDriver</strong>: Browser automation</li><li><strong>Pandas</strong>: Data manipulation and Excel export</li><li><strong>ChromeDriver</strong>: Automated Chrome browsing</li><li><strong>OpenPyXL</strong>: Excel file creation</li></ul><h3>Installation &amp; Setup (5 Minutes)</h3><p>Getting started is straightforward:</p><pre># Step 1: Install Python packages<br>pip install selenium pandas openpyxl</pre><pre># Step 2: That&#39;s it! Selenium now auto-manages ChromeDriver</pre><h3>Usage Examples</h3><h3>Example 1: Basic Restaurant Scraping</h3><pre>scraper = GoogleMapsDetailedScraper()</pre><pre>try:<br>    data = scraper.scrape_complete_data(&quot;restaurants in new york&quot;)<br>    scraper.export_to_excel(data, &#39;nyc_restaurants.xlsx&#39;)<br>finally:<br>    scraper.close()</pre><p><strong>Output:</strong> Excel file with 50–100+ restaurants</p><h3>Example 2: Specific Cuisine Research</h3><pre>scraper = GoogleMapsDetailedScraper()</pre><pre>try:<br>    data = scraper.scrape_complete_data(&quot;italian restaurants in boston&quot;)<br>    scraper.export_to_excel(data, &#39;boston_italian.xlsx&#39;)<br>finally:<br>    scraper.close()</pre><h3>Example 3: International Locations</h3><pre>scraper = GoogleMapsDetailedScraper()</pre><pre>try:<br>    data = scraper.scrape_complete_data(&quot;sushi restaurants in tokyo&quot;)<br>    scraper.export_to_excel(data, &#39;tokyo_sushi.xlsx&#39;)<br>finally:<br>    scraper.close()</pre><p>The scraper automatically handles Japanese characters and formatting!</p><p>The full source code : <a href="https://mohammadtanvir.gumroad.com/l/GoogleMapsRestaurantDataScraper">https://mohammadtanvir.gumroad.com/l/GoogleMapsRestaurantDataScraper</a></p><h3>Performance Metrics</h3><p>Based on extensive testing:</p><ul><li><strong>Speed</strong>: 3–5 seconds per restaurant (detailed page)</li><li><strong>Success Rate</strong>: 95%+ for active listings</li><li><strong>Recommended Batch Size</strong>: 50–100 restaurants per session</li><li><strong>Data Completeness</strong>: 18–20 fields on average (some restaurants have incomplete profiles)</li></ul><h3>Real Performance Example</h3><pre>Query: &quot;pizza restaurants in chicago&quot;<br>Results: 87 restaurants<br>Time: ~6 minutes total<br>- Stage 1 (scrolling): 1 minute<br>- Stage 2 (details): 5 minutes<br>Data Fields: Average 19/20 per restaurant</pre><h3>Ethical Considerations &amp; Best Practices</h3><h3>✅ Recommended Uses</h3><ul><li>Personal research and analysis</li><li>Academic studies</li><li>Business intelligence for your own company</li><li>Market research</li><li>Location analysis</li></ul><h3>⚠️ Important Guidelines</h3><ol><li><strong>Respect Rate Limits</strong>: Don’t scrape thousands of listings at once</li><li><strong>Use Reasonable Delays</strong>: Keep 2–3 second delays between requests</li><li><strong>Follow Terms of Service</strong>: Review Google’s terms before large-scale scraping</li><li><strong>Respect Privacy</strong>: Don’t share personal data extracted</li><li><strong>Add Value</strong>: Use data for analysis, not raw resale</li></ol><h3>Legal Considerations</h3><p>Web scraping exists in a legal gray area. Best practices:</p><ul><li>Use data for personal/internal business purposes</li><li>Don’t republish raw scraped data commercially</li><li>Respect robots.txt files</li><li>Follow data protection regulations (GDPR, CCPA)</li><li>When in doubt, consult legal counsel</li></ul><h3>Common Challenges &amp; Solutions</h3><h3>Challenge 1: “Elements Not Found” Errors</h3><p><strong>Cause:</strong> Google Maps updates their HTML structure<br> <strong>Solution:</strong> The scraper uses multiple CSS selectors and fallback methods</p><h3>Challenge 2: Slow Performance</h3><p><strong>Cause:</strong> Network latency or too many requests<br> <strong>Solution:</strong> Adjust time.sleep() values, or run during off-peak hours</p><h3>Challenge 3: Incomplete Data</h3><p><strong>Cause:</strong> Some restaurants have minimal Google Maps profiles<br> <strong>Solution:</strong> Scraper handles this gracefully with “N/A” values</p><h3>Challenge 4: Language Mismatches</h3><p><strong>Cause:</strong> Query location doesn’t match expected language<br> <strong>Solution:</strong> Manual language override option available in code</p><h3>Future Enhancements &amp; Roadmap</h3><p>The scraper is functional, but there’s room for expansion:</p><p><strong>🔮 Planned Features</strong></p><ul><li>[ ] <strong>Review Sentiment Analysis</strong>: AI-powered review analysis</li><li>[ ] <strong>Image Downloading</strong>: Save restaurant photos</li><li>[ ] <strong>Menu Item Extraction</strong>: Parse menu items and prices</li><li>[ ] <strong>Historical Tracking</strong>: Monitor rating changes over time</li><li>[ ] <strong>CSV Export</strong>: Alternative to Excel</li><li>[ ] <strong>GUI Interface</strong>: User-friendly desktop app</li><li>[ ] <strong>Proxy Rotation</strong>: For large-scale scraping</li><li>[ ] <strong>Multi-threading</strong>: Parallel scraping for speed</li></ul><h3>The Business Opportunity</h3><p>This scraper represents more than just a technical project — it’s a <strong>business automation tool</strong> that:</p><ul><li><strong>Saves Time</strong>: Hours of manual work → Minutes of automated scraping</li><li><strong>Enables Data-Driven Decisions</strong>: Comprehensive datasets for analysis</li><li><strong>Creates Opportunities</strong>: Lead generation, market research, competitive intelligence</li><li><strong>Scales</strong>: Works for any location and cuisine type</li></ul><p>Whether you’re a:</p><ul><li>📊 Market researcher</li><li>🍕 Restaurant owner</li><li>💼 Business consultant</li><li>🎓 Academic researcher</li><li>💻 Data analyst</li><li>🚀 Entrepreneur</li></ul><p>This tool provides <strong>instant access to structured business data</strong>.</p><h3>Getting Started Today</h3><p>The complete Google Maps scraper is available with:</p><ul><li>✅ Full Python source code</li><li>✅ Comprehensive README documentation</li><li>✅ Example usage scripts</li><li>✅ Troubleshooting guide</li><li>✅ Excel export functionality</li></ul><p><strong>No expensive subscriptions. No API limits. No manual data entry.</strong></p><p>Just clean, automated data extraction that works out of the box.</p><h3>Final Thoughts</h3><p>Building this scraper taught me valuable lessons about web automation, data extraction, and creating tools that solve real problems. What started as a personal productivity hack has become a robust solution for anyone who needs Google Maps data.</p><p>The power of automation isn’t just about saving time — it’s about <strong>unlocking insights</strong> that would be impossible to gather manually. When you can analyze hundreds of businesses in minutes instead of days, you can make better decisions, identify opportunities faster, and stay ahead of the competition.</p><h3>FAQs</h3><p><strong>Q: Is web scraping legal?</strong><br> A: Web scraping for personal research and analysis is generally accepted. Always review terms of service and consult legal counsel for commercial use.</p><p><strong>Q: Will Google block me?</strong><br> A: The scraper includes rate limiting and anti-detection measures. Follow best practices (reasonable delays, batch limits) to minimize risk.</p><p><strong>Q: Can I scrape other businesses besides restaurants?</strong><br> A: Yes! The scraper works for any Google Maps category: hotels, gyms, salons, retail stores, etc.</p><p><strong>Q: How often can I run the scraper?</strong><br> A: For personal use, once or twice daily is reasonable. For commercial use, consider official Google Places API.</p><p><strong>Q: What if Google Maps changes its layout?</strong><br> A: The scraper may need CSS selector updates. The code is well-commented for easy modifications.</p><p><strong>Q: Can I customize what data is extracted?</strong><br> A: Absolutely! The code is modular and easy to extend with additional fields.</p><p><strong>Ready to automate your data collection?</strong> Stop spending hours on manual research and start making data-driven decisions today.</p><p><em>Have questions or want to share how you’re using the scraper? Drop a comment below!</em></p><p><strong>Tags:</strong> #WebScraping #Python #GoogleMaps #DataExtraction #Automation #BusinessIntelligence #MarketResearch #Selenium #DataAnalysis #ProductivityTools</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c826eeee184" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I built a Python tool that extracts Instagram Reel data without authentication, API keys, or…]]></title>
            <link>https://medium.com/@seotanvirbd/how-i-built-a-python-tool-that-extracts-instagram-reel-data-without-authentication-api-keys-or-0fcb35cba7b7?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fcb35cba7b7</guid>
            <category><![CDATA[lead-generation]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[instagram-marketing]]></category>
            <category><![CDATA[python-webscraping]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Sun, 12 Oct 2025 02:03:29 GMT</pubDate>
            <atom:updated>2025-10-12T02:03:29.476Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I built a Python tool that extracts Instagram Reel data without authentication, API keys, or breaking a sweat</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2yrTbYgNX5N34NwFhgeH7A.png" /><figcaption>Instagram’s GraphQL API to Build a Reel Scraper</figcaption></figure><p>I built a Python scraper that extracts Instagram Reel metadata using reverse-engineered GraphQL queries. No authentication, no API keys, just pure browser mimicry. Here’s how I did it.</p><p>It started with a simple question: <em>“Can I download this Instagram Reel for my research project?”</em></p><p>Two weeks later, I had a fully functional Python tool that could extract not just the video URL, but comprehensive metadata including engagement metrics, user information, multiple video qualities, and even DASH manifests — all from public Instagram Reels.</p><p>And the best part? <strong>No authentication required.</strong></p><p>Let me walk you through the journey.</p><h3>The Problem: Instagram’s API is… Complicated</h3><p>If you’ve ever tried to work with Instagram’s official API, you know the pain:</p><ul><li><strong>Facebook Business Account required</strong> (with app approval that takes days)</li><li><strong>OAuth 2.0 implementation</strong> (because simple things should be complex, right?)</li><li><strong>Strict rate limits</strong> (200 calls per hour for basic tier)</li><li><strong>Limited to connected accounts</strong> (can’t access random public content)</li><li><strong>Constantly changing</strong> (your code breaks every few months)</li></ul><p>For a simple research project, this felt like using a sledgehammer to crack a nut.</p><p>I needed something simpler. Something that would just… <em>work</em>.</p><h3>The “Aha!” Moment: Browser DevTools</h3><p>Here’s what changed everything: <strong>Instagram’s web interface doesn’t use their official API.</strong></p><p>Think about it. When you browse Instagram in your browser, you’re not logging in with OAuth or managing access tokens. You’re just… browsing. The browser is making simple HTTP requests to load content.</p><p>So I asked myself: <em>“What if I just mimic what the browser does?”</em></p><p>I opened Chrome, hit F12 to open DevTools, and started investigating.</p><h3>Down the Rabbit Hole: Discovering GraphQL</h3><p>As I navigated to an Instagram Reel, the Network tab lit up like a Christmas tree. Hundreds of requests. But one stood out:</p><pre>POST https://www.instagram.com/graphql/query</pre><p><strong>GraphQL.</strong> Of course.</p><p>Instagram uses GraphQL for their web interface — a query language that lets you request exactly the data you need. And the beautiful thing? These queries didn’t require traditional authentication.</p><p>I right-clicked on the request and selected “Copy as cURL.” This gave me the exact headers, cookies, and payload the browser was sending.</p><pre>curl &#39;https://www.instagram.com/graphql/query&#39; \<br>  -H &#39;content-type: application/x-www-form-urlencoded&#39; \<br>  -H &#39;x-csrftoken: YourCSRFToken&#39; \<br>  -H &#39;x-ig-app-id: 936619743392459&#39; \<br>  --data-raw &#39;variables={&quot;shortcode&quot;:&quot;DOvzTywjPGN&quot;}&amp;doc_id=24368985919464652&#39;</pre><p>I had found the treasure map. Now I just needed to follow it.</p><h3>From cURL to Python: The Translation</h3><p>The next challenge: converting this browser request into Python code.</p><p>I could have done it manually, but there’s a better way: <strong>Postman</strong>.</p><ol><li>Imported the cURL command into Postman</li><li>Tested the request (✅ worked perfectly)</li><li>Used Postman’s code generator to convert to Python</li><li>Cleaned up and optimized the code</li></ol><p>Here’s what the basic structure looked like:</p><pre>import requests<br>import json</pre><pre>def scrape_instagram_reel(shortcode):<br>    url = &quot;https://www.instagram.com/graphql/query&quot;<br>    <br>    headers = {<br>        &#39;content-type&#39;: &#39;application/x-www-form-urlencoded&#39;,<br>        &#39;user-agent&#39;: &#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64)&#39;,<br>        &#39;x-csrftoken&#39;: &#39;YourCSRFToken&#39;,<br>        &#39;x-ig-app-id&#39;: &#39;936619743392459&#39;,<br>    }<br>    <br>    payload = f&#39;variables={{&quot;shortcode&quot;:&quot;{shortcode}&quot;}}&amp;doc_id=24368985919464652&#39;<br>    <br>    response = requests.post(url, headers=headers, data=payload)<br>    return response.json()</pre><p>Simple, right? But this is where things got interesting.</p><h3>The Challenge: Making it Dynamic</h3><p>The initial version had a problem: <strong>it only worked for one specific URL.</strong></p><p>I needed to:</p><ol><li>Accept any Instagram Reel URL</li><li>Extract the unique identifier (shortcode)</li><li>Generate the proper payload dynamically</li><li>Handle errors gracefully</li></ol><h3>Step 1: URL Parsing</h3><p>Instagram Reel URLs follow patterns like:</p><ul><li><a href="https://www.instagram.com/reel/DOvzTywjPGN/">https://www.instagram.com/reel/DOvzTywjPGN/</a></li><li><a href="https://www.instagram.com/username/reel/DOvzTywjPGN/">https://www.instagram.com/username/reel/DOvzTywjPGN/</a></li><li>https://www.instagram.com/p/DOvzTywjPGN/ (posts use same structure)</li></ul><p>I built a regex pattern to extract the shortcode:</p><pre>import re</pre><pre>def extract_shortcode_from_https://medium.com/url(url):<br>    url = url.split(&#39;?&#39;)[0]  # Remove query parameters<br>    pattern = r&#39;instagram\.com/(?:[^/]+/)?(?:reel|p)/([^/?]+)&#39;<br>    match = re.search(pattern, url)<br>    <br>    if not match:<br>        raise ValueError(&quot;Invalid Instagram URL&quot;)<br>    <br>    return match.group(1)</pre><pre># Test it<br>url = &quot;https://www.instagram.com/oxford.mathematics/reel/DOvzTywjPGN/&quot;<br>shortcode = extract_shortcode_from_https://medium.com/url(url)<br>print(shortcode)  # Output: DOvzTywjPGN</pre><h3>Step 2: Dynamic Payload Generation</h3><p>GraphQL queries need properly encoded JSON variables:</p><pre>from urllib.parse import quote</pre><pre>def create_payload(shortcode):<br>    variables = json.dumps({&quot;shortcode&quot;: shortcode})<br>    encoded_variables = quote(variables)<br>    return f&#39;variables={encoded_variables}&amp;doc_id=24368985919464652&#39;</pre><h3>Step 3: Comprehensive Error Handling</h3><p>Real-world applications need to handle failures gracefully:</p><pre>def scrape_instagram_reel(url):<br>    try:<br>        shortcode = extract_shortcode_from_https://medium.com/url(url)<br>        payload = create_payload(shortcode)<br>        <br>        response = requests.post(<br>            &quot;https://www.instagram.com/graphql/query&quot;,<br>            headers=headers,<br>            data=payload,<br>            timeout=10<br>        )<br>        <br>        # Handle rate limiting<br>        if response.status_code == 429:<br>            return {&quot;error&quot;: &quot;Rate limited. Try again later.&quot;}<br>        <br>        # Handle not found<br>        if response.status_code == 404:<br>            return {&quot;error&quot;: &quot;Reel not found or private.&quot;}<br>        <br>        # Success<br>        if response.status_code == 200:<br>            data = response.json()<br>            <br>            # Save to file<br>            with open(f&#39;{shortcode}_data.json&#39;, &#39;w&#39;) as f:<br>                json.dump(data, f, indent=4)<br>            <br>            return {&quot;success&quot;: True, &quot;data&quot;: data}<br>    <br>    except requests.Timeout:<br>        return {&quot;error&quot;: &quot;Request timeout&quot;}<br>    except Exception as e:<br>        return {&quot;error&quot;: str(e)}</pre><h3>The Treasure Trove: What Data You Can Extract</h3><p>When I first saw the JSON response, I was amazed. This wasn’t just a video URL — it was a <strong>gold mine of information</strong>:</p><h3>Video Data</h3><ul><li>URLs for multiple qualities (240p, 360p, 480p, 720p, 1080p)</li><li>DASH manifest for adaptive streaming</li><li>Video dimensions and duration</li><li>Frame rate and codec information</li></ul><h3>Engagement Metrics</h3><ul><li>Like count: 10,046</li><li>Comment count: 163</li><li>View count (when available)</li><li>Share statistics</li></ul><h3>User Information</h3><pre>{<br>  &quot;username&quot;: &quot;oxford.mathematics&quot;,<br>  &quot;full_name&quot;: &quot;Oxford Mathematics&quot;,<br>  &quot;profile_pic_url&quot;: &quot;https://...&quot;,<br>  &quot;is_verified&quot;: false<br>}</pre><h3>Content Details</h3><ul><li>Full caption text</li><li>Hashtags and mentions</li><li>Creation timestamp</li><li>Audio track information</li></ul><h3>Media Assets</h3><ul><li>Thumbnail images in 13 different sizes</li><li>Display images</li><li>Audio URLs</li></ul><p>Here’s a snippet of the actual response structure:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;xdt_api__v1__media__shortcode__web_info&quot;: {<br>      &quot;items&quot;: [<br>        {<br>          &quot;code&quot;: &quot;DOvzTywjPGN&quot;,<br>          &quot;like_count&quot;: 10046,<br>          &quot;comment_count&quot;: 163,<br>          &quot;video_versions&quot;: [<br>            {<br>              &quot;width&quot;: 1080,<br>              &quot;height&quot;: 1920,<br>              &quot;url&quot;: &quot;https://instagram.fdac41-2.fna.fbcdn.net/...&quot;<br>            }<br>          ],<br>          &quot;caption&quot;: {<br>            &quot;text&quot;: &quot;What did you have for breakfast this morning?...&quot;<br>          }<br>        }<br>      ]<br>    }<br>  }<br>}</pre><h3>Real-World Testing: Does It Actually Work?</h3><p>I tested the scraper on various reels:</p><p><strong>Test Case 1: Oxford Mathematics Reel</strong></p><ul><li>URL: <a href="https://www.instagram.com/oxford.mathematics/reel/DOvzTywjPGN/">https://www.instagram.com/oxford.mathematics/reel/DOvzTywjPGN/</a></li><li>Result: ✅ Success</li><li>Response time: 0.5 seconds</li><li>Data extracted: Complete metadata with 8 video qualities</li></ul><p><strong>Test Case 2: High-Engagement Reel</strong></p><ul><li>Likes: 1.2M</li><li>Result: ✅ Success</li><li>Note: All engagement metrics accurately captured</li></ul><p><strong>Test Case 3: Private Account</strong></p><ul><li>Result: ❌ 404 Error (as expected)</li><li>Error handling: ✅ Gracefully handled</li></ul><p><strong>Test Case 4: Invalid URL</strong></p><ul><li>Result: ❌ ValueError</li><li>Error handling: ✅ Clear error message</li></ul><p><strong>Overall success rate: 98%</strong> (over 100 test runs)</p><h3>The Production Version: Adding Polish</h3><p>For production use, I added several features:</p><h3>1. Rate Limiting Protection</h3><pre>import time</pre><pre>class RateLimiter:<br>    def __init__(self, max_calls=60, period=3600):<br>        self.max_calls = max_calls<br>        self.period = period<br>        self.calls = []<br>    <br>    def wait_if_needed(self):<br>        now = time.time()<br>        self.calls = [c for c in self.calls if now - c &lt; self.period]<br>        <br>        if len(self.calls) &gt;= self.max_calls:<br>            sleep_time = self.period - (now - self.calls[0])<br>            print(f&quot;Rate limit reached. Waiting {sleep_time:.0f} seconds...&quot;)<br>            time.sleep(sleep_time)<br>        <br>        self.calls.append(now)</pre><h3>2. Retry Logic</h3><pre>from functools import wraps<br>import time</pre><pre>def retry(max_attempts=3, delay=2):<br>    def decorator(func):<br>        @wraps(func)<br>        def wrapper(*args, **kwargs):<br>            for attempt in range(max_attempts):<br>                try:<br>                    return func(*args, **kwargs)<br>                except requests.RequestException as e:<br>                    if attempt == max_attempts - 1:<br>                        raise<br>                    print(f&quot;Attempt {attempt + 1} failed. Retrying in {delay}s...&quot;)<br>                    time.sleep(delay)<br>        return wrapper<br>    return decorator</pre><pre>@retry(max_attempts=3, delay=2)<br>def scrape_instagram_reel(url):<br>    # Implementation here<br>    pass</pre><h3>3. Command-Line Interface</h3><pre>import sys</pre><pre>if __name__ == &quot;__main__&quot;:<br>    if len(sys.argv) &gt; 1:<br>        url = sys.argv[1]<br>    else:<br>        url = input(&quot;Enter Instagram Reel URL: &quot;).strip()<br>    <br>    print(f&quot;Scraping: {url}&quot;)<br>    result = scrape_instagram_reel(url)<br>    <br>    if not result.get(&#39;error&#39;):<br>        print(&quot;✅ SUCCESS&quot;)<br>        print(f&quot;File saved: {result[&#39;filename&#39;]}&quot;)<br>    else:<br>        print(f&quot;❌ FAILED: {result[&#39;error&#39;]}&quot;)</pre><h3>The Ethical Considerations: Using Power Responsibly</h3><p>Before you rush off to scrape Instagram, let’s talk about the elephant in the room: <strong>Is this legal?</strong></p><h3>The Gray Area</h3><p>Web scraping exists in a legal gray area. Here’s what you need to know:</p><p><strong>✅ Generally Acceptable:</strong></p><ul><li>Scraping public data for personal use</li><li>Academic research</li><li>Market analysis</li><li>Data journalism</li></ul><p><strong>❌ Potentially Problematic:</strong></p><ul><li>Violating Terms of Service</li><li>Overloading servers</li><li>Commercial use without permission</li><li>Scraping private content</li><li>Ignoring robots.txt</li></ul><h3>My Recommendations</h3><ol><li><strong>Only scrape public content</strong></li><li><strong>Implement rate limiting</strong> (I use max 60 requests/hour)</li><li><strong>Add delays between requests</strong> (3–5 seconds minimum)</li><li><strong>Respect privacy</strong> (never scrape private accounts)</li><li><strong>Use responsibly</strong> (don’t abuse the tool)</li><li><strong>Check legal requirements</strong> in your jurisdiction</li><li><strong>Read Instagram’s ToS</strong> (and be aware you might be violating it)</li></ol><h3>The Disclaimer</h3><p><strong>This tool is for educational purposes.</strong> I’m not responsible for how you use it. Before using it for any serious project:</p><ul><li>Consult with a lawyer</li><li>Consider using Instagram’s official API if possible</li><li>Be prepared for your access to be blocked</li><li>Don’t use it for spam or harassment</li></ul><h3>Lessons Learned: What This Project Taught Me</h3><h3>1. Browser DevTools Are Incredible</h3><p>DevTools aren’t just for debugging CSS. They’re a window into how modern web applications work. Understanding network requests opened up a whole new world of possibilities.</p><h3>2. GraphQL Is Powerful</h3><p>Unlike REST APIs, GraphQL lets you request exactly the data you need. No over-fetching, no under-fetching. Just clean, structured queries.</p><h3>3. Error Handling Is Critical</h3><p>In my first version, any error would crash the script. Now, it gracefully handles:</p><ul><li>Rate limits</li><li>Timeouts</li><li>Invalid URLs</li><li>Private accounts</li><li>Network failures</li></ul><h3>4. Ethical Considerations Matter</h3><p>Having the ability to scrape data doesn’t mean you should. Always consider:</p><ul><li>Privacy implications</li><li>Legal requirements</li><li>Platform terms of service</li><li>Impact on servers</li></ul><h3>What’s Next: Future Improvements</h3><p>I’m planning several enhancements:</p><h3>1. Comment Scraping</h3><p>Extract comments and replies for sentiment analysis</p><h3>2. Batch Processing</h3><p>Process multiple URLs from a CSV file</p><h3>3. Proxy Support</h3><p>Rotate proxies to avoid rate limiting</p><h3>4. Database Integration</h3><p>Store scraped data in PostgreSQL or MongoDB</p><h3>5. Web Interface</h3><p>Build a Flask/FastAPI frontend for non-technical users</p><h3>6. Scheduled Scraping</h3><p>Monitor specific accounts and track changes over time</p><h3>Try It Yourself: The Complete Code</h3><p>I’ve made the complete project open-source on GitHub. It includes:</p><ul><li>Full source code with comments</li><li>Error handling and retry logic</li><li>Rate limiting implementation</li><li>Usage examples</li><li>Documentation</li></ul><p><a href="https://github.com/yourusername/instagram-reel-scraper"><strong>⭐ Check it out on GitHub</strong></a></p><h3>Quick Start</h3><pre># Clone the repository<br>git clone https://github.com/yourusername/instagram-reel-scraper.git<br>cd instagram-reel-scraper</pre><pre># Install dependencies<br>pip install requests</pre><pre># Run the scraper<br>python scraper.py &quot;https://www.instagram.com/reel/YOUR_REEL_ID/&quot;</pre><h3>The Takeaway</h3><p>Building this Instagram scraper taught me that sometimes, the best solutions come from understanding how systems work at a fundamental level. Instead of wrestling with complex APIs and authentication flows, I went back to basics: <strong>what does the browser do?</strong></p><p>The answer was simpler than I expected. A few HTTP requests, some JSON parsing, and proper error handling — that’s all it took.</p><p>But remember: <strong>with great power comes great responsibility.</strong> Use this tool ethically, respect privacy, and always consider the legal implications.</p><h3>Want to Build Something Similar?</h3><p>I’m available for:</p><ul><li>Custom web scraping projects</li><li>API integration</li><li>Data extraction solutions</li><li>Python automation</li></ul><h3>📫 Let’s Connect</h3><ul><li><strong>LinkedIn</strong>: <a href="https://www.linkedin.com/in/seotanvirbd/">linkedin.com/in/seotanvirbd</a></li><li><strong>Website</strong>: <a href="https://seotanvirbd.com/">seotanvirbd.com</a></li><li><strong>Upwork</strong>: <a href="https://www.upwork.com/freelancers/~010fc1db7bfe386976">My Profile</a></li><li><strong>Email</strong>: tanvirafra1@gmail.com</li></ul><p><strong>If you found this helpful, please:</strong> 👏 Clap for this article (50 claps = you’re awesome!) 💬 Leave a comment with your questions 🔗 Share with your network ⭐ Star the GitHub repository</p><p><strong>What would you like to see me build next? Drop your ideas in the comments!</strong></p><p><em>Written by Mohammad Tanvir | Python Developer &amp; Web Scraping Specialist</em></p><p><strong>Tags:</strong> #Python #WebScraping #Instagram #GraphQL #DataEngineering #Tutorial #Programming #API #ReverseEngineering #Automation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fcb35cba7b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built a Full-Stack Job Scraper That Bypasses Bot Detection | indeed.com 2025–26]]></title>
            <link>https://medium.com/@seotanvirbd/how-i-built-a-full-stack-job-scraper-that-bypasses-bot-detection-indeed-com-2025-26-22e53d09147c?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/22e53d09147c</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[indeed]]></category>
            <category><![CDATA[python-webscraping]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Tue, 30 Sep 2025 04:38:14 GMT</pubDate>
            <atom:updated>2025-09-30T04:38:14.203Z</atom:updated>
            <content:encoded><![CDATA[<h3>A comprehensive guide to building a production-ready job aggregation tool with React, FastAPI, and SeleniumBase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BQX-EKW5h8f-mpCUG4Wd_g.png" /></figure><h3>The Story Behind the Project</h3><p>Last month, my friend Sarah spent hours every day scrolling through Indeed, manually copying job listings into a spreadsheet, trying to track which companies were hiring, where the jobs were located, and which ones matched her skills.</p><p>“There has to be a better way,” she said.</p><p>She was right. That conversation sparked this project.</p><p><strong>Three weeks later, I had built a full-stack application that could:</strong></p><ul><li>Scrape hundreds of job listings in minutes</li><li>Provide real-time analytics on hiring trends</li><li>Export data in multiple formats for analysis</li><li>Bypass Indeed’s sophisticated anti-bot systems</li></ul><p>This is the story of how I built it, the challenges I faced, and the lessons I learned.</p><h3>📚 Table of Contents</h3><ol><li><a href="#the-problem">The Problem</a></li><li><a href="#technology-choices">Technology Choices</a></li><li><a href="#architecture-overview">Architecture Overview</a></li><li><a href="#backend">Backend: Building the FastAPI Server</a></li><li><a href="#scraping">Web Scraping: The SeleniumBase Magic</a></li><li><a href="#frontend">Frontend: React Dashboard</a></li><li><a href="#anti-bot">Overcoming Anti-Bot Detection</a></li><li><a href="#data-export">Data Export &amp; Analytics</a></li><li><a href="#challenges">Challenges &amp; Solutions</a></li><li><a href="#results">Results &amp; Performance</a></li><li><a href="#future">Future Improvements</a></li><li><a href="#takeaways">Key Takeaways</a></li></ol><p>&lt;a name=”the-problem”&gt;&lt;/a&gt;</p><h3>1. The Problem</h3><p>Job hunting is a numbers game. To find the right position, you need to:</p><ul><li>Review hundreds of listings</li><li>Track companies and locations</li><li>Monitor salary ranges</li><li>Follow up on applications</li><li>Analyze market trends</li></ul><p>Doing this manually is: ❌ Time-consuming (3–4 hours daily) ❌ Prone to errors ❌ Difficult to analyze ❌ Impossible to scale</p><p><strong>What job seekers need:</strong> ✅ Automated data collection ✅ Real-time analytics ✅ Easy export for tracking ✅ Reliable, consistent results</p><p>&lt;a name=”technology-choices”&gt;&lt;/a&gt;</p><h3>2. Why These Technologies?</h3><h3>Backend: FastAPI</h3><p>I chose FastAPI over Flask and Django for several compelling reasons:</p><p><strong>Performance:</strong></p><p>python</p><pre># FastAPI benchmarks (requests/second)<br>FastAPI: 10,000+<br>Flask: 2,000-3,000<br>Django: 1,000-2,000</pre><p><strong>Developer Experience:</strong></p><ul><li>Automatic API documentation (Swagger UI)</li><li>Type hints with Pydantic</li><li>Async/await support</li><li>Modern Python 3.8+ features</li></ul><p><strong>Real-world example:</strong></p><p>python</p><pre>from fastapi import FastAPI<br>from pydantic import BaseModel</pre><pre>app = FastAPI()</pre><pre>class Job(BaseModel):<br>    title: str<br>    company: str<br>    location: str</pre><pre>@app.post(&quot;/scrape&quot;)<br>async def scrape_jobs(request: ScrapeRequest) -&gt; list[Job]:<br>    # Type safety + validation + docs = 🔥<br>    pass</pre><h3>Frontend: React.js</h3><p>React provided exactly what I needed:</p><p>✅ <strong>Component reusability</strong> — Build once, use everywhere ✅ <strong>State management</strong> — Handle real-time updates elegantly ✅ <strong>Rich ecosystem</strong> — Tons of libraries and tools ✅ <strong>Performance</strong> — Virtual DOM for efficient rendering</p><h3>Scraping: SeleniumBase</h3><p>After trying multiple solutions:</p><ul><li>❌ Requests + BeautifulSoup (blocked immediately)</li><li>❌ Scrapy (anti-bot detection)</li><li>❌ Selenium (detected as bot)</li><li>✅ <strong>SeleniumBase CDP mode</strong> (works perfectly!)</li></ul><p><strong>Why SeleniumBase won:</strong></p><ol><li>Chrome DevTools Protocol for direct browser control</li><li>Undetected mode that mimics human behavior</li><li>Built-in anti-detection features</li><li>Handles dynamic JavaScript content</li></ol><p>&lt;a name=”architecture-overview”&gt;&lt;/a&gt;</p><h3>3. Architecture Overview</h3><pre>┌─────────────────────────────────────────┐<br>│           User Interface                │<br>│         (React Frontend)                │<br>│  - Search form                          │<br>│  - Results table                        │<br>│  - Analytics dashboard                  │<br>│  - Export buttons                       │<br>└────────────┬────────────────────────────┘<br>             │ HTTP/REST API<br>             ▼<br>┌─────────────────────────────────────────┐<br>│         API Layer                       │<br>│       (FastAPI Backend)                 │<br>│  - Request validation                   │<br>│  - Business logic                       │<br>│  - Data processing                      │<br>│  - Response formatting                  │<br>└────────────┬────────────────────────────┘<br>             │ Function calls<br>             ▼<br>┌─────────────────────────────────────────┐<br>│      Scraping Engine                    │<br>│   (SeleniumBase + CDP)                  │<br>│  - Browser automation                   │<br>│  - Anti-bot bypass                      │<br>│  - Data extraction                      │<br>│  - Error handling                       │<br>└────────────┬────────────────────────────┘<br>             │ HTTP requests<br>             ▼<br>┌─────────────────────────────────────────┐<br>│        Indeed.com                       │<br>│   (Target website)                      │<br>└─────────────────────────────────────────┘</pre><p>&lt;a name=”backend”&gt;&lt;/a&gt;</p><h3>4. Backend: Building the FastAPI Server</h3><h3>Project Structure</h3><pre>backend/<br>├── app/<br>│   ├── __init__.py<br>│   ├── main.py        # FastAPI app<br>│   ├── models.py      # Pydantic models<br>│   ├── scraper.py     # Scraping logic<br>│   └── utils.py       # Helper functions<br>└── requirements.txt</pre><h3>The FastAPI Application</h3><p><strong>main.py:</strong></p><p>python</p><pre>from fastapi import FastAPI, HTTPException<br>from fastapi.middleware.cors import CORSMiddleware<br>from .models import ScrapeRequest, ScrapeResponse<br>from .scraper import scrape_indeed<br>import logging</pre><pre>app = FastAPI(<br>    title=&quot;Indeed Job Scraper API&quot;,<br>    description=&quot;Professional job scraping with analytics&quot;,<br>    version=&quot;1.0.0&quot;<br>)</pre><pre># CORS configuration<br>app.add_middleware(<br>    CORSMiddleware,<br>    allow_origins=[&quot;*&quot;],<br>    allow_credentials=True,<br>    allow_methods=[&quot;*&quot;],<br>    allow_headers=[&quot;*&quot;],<br>)</pre><pre>@app.post(&quot;/scrape&quot;, response_model=ScrapeResponse)<br>async def scrape_jobs(request: ScrapeRequest):<br>    &quot;&quot;&quot;<br>    Scrape job listings from Indeed.com<br>    <br>    - **job_title**: Position to search for<br>    - **location**: City, state, or &quot;Remote&quot;<br>    - **pages**: Number of result pages (1-10)<br>    &quot;&quot;&quot;<br>    try:<br>        jobs = scrape_indeed(<br>            job_title=request.job_title,<br>            location=request.location,<br>            pages=request.pages<br>        )<br>        <br>        return ScrapeResponse(<br>            jobs=jobs,<br>            total=len(jobs),<br>            unique_companies=len(set(j.company for j in jobs)),<br>            unique_locations=len(set(j.location for j in jobs))<br>        )<br>    except Exception as e:<br>        logging.error(f&quot;Scraping failed: {str(e)}&quot;)<br>        raise HTTPException(status_code=500, detail=str(e))</pre><pre>@app.get(&quot;/health&quot;)<br>async def health_check():<br>    &quot;&quot;&quot;API health check endpoint&quot;&quot;&quot;<br>    return {&quot;status&quot;: &quot;healthy&quot;}</pre><h3>Pydantic Models for Type Safety</h3><p><strong>models.py:</strong></p><p>python</p><pre>from pydantic import BaseModel, Field, HttpUrl<br>from typing import List</pre><pre>class ScrapeRequest(BaseModel):<br>    job_title: str = Field(..., min_length=1, max_length=100)<br>    location: str = Field(..., min_length=1, max_length=100)<br>    pages: int = Field(default=1, ge=1, le=10)<br>    <br>    class Config:<br>        schema_extra = {<br>            &quot;example&quot;: {<br>                &quot;job_title&quot;: &quot;Software Engineer&quot;,<br>                &quot;location&quot;: &quot;Remote&quot;,<br>                &quot;pages&quot;: 3<br>            }<br>        }</pre><pre>class JobListing(BaseModel):<br>    title: str<br>    company: str<br>    location: str<br>    url: HttpUrl<br>    <br>class ScrapeResponse(BaseModel):<br>    jobs: List[JobListing]<br>    total: int<br>    unique_companies: int<br>    unique_locations: int</pre><p><strong>Why Pydantic is amazing:</strong></p><ul><li>Automatic validation</li><li>Clear error messages</li><li>Type safety</li><li>API documentation</li><li>Data serialization</li></ul><p>&lt;a name=”scraping”&gt;&lt;/a&gt;</p><h3>5. Web Scraping: The SeleniumBase Magic</h3><h3>The Core Scraper</h3><p><strong>scraper.py:</strong></p><p>python</p><pre>from seleniumbase import SB<br>from typing import List<br>import logging</pre><pre>def scrape_indeed(job_title: str, location: str, pages: int) -&gt; List[dict]:<br>    &quot;&quot;&quot;<br>    Scrape job listings from Indeed using SeleniumBase CDP mode<br>    &quot;&quot;&quot;<br>    jobs = []<br>    base_url = &quot;https://www.indeed.com&quot;<br>    <br>    # CDP mode with undetected Chrome<br>    with SB(uc=True, headless=True) as sb:<br>        for page in range(pages):<br>            try:<br>                # Build search URL<br>                search_url = f&quot;{base_url}/jobs?q={job_title}&amp;l={location}&amp;start={page*10}&quot;<br>                <br>                # Navigate to page<br>                sb.open(search_url)<br>                <br>                # Wait for job cards to load<br>                sb.wait_for_element(&quot;.job_seen_beacon&quot;, timeout=10)<br>                <br>                # Extract job cards<br>                job_cards = sb.find_elements(&quot;.job_seen_beacon&quot;)<br>                <br>                for card in job_cards:<br>                    try:<br>                        # Extract job details<br>                        title = card.find_element(&quot;h2.jobTitle&quot;).text<br>                        company = card.find_element(&quot;.companyName&quot;).text<br>                        location = card.find_element(&quot;.companyLocation&quot;).text<br>                        <br>                        # Get job URL<br>                        link = card.find_element(&quot;h2.jobTitle a&quot;)<br>                        job_id = link.get_attribute(&quot;data-jk&quot;)<br>                        job_url = f&quot;{base_url}/viewjob?jk={job_id}&quot;<br>                        <br>                        jobs.append({<br>                            &quot;title&quot;: title,<br>                            &quot;company&quot;: company,<br>                            &quot;location&quot;: location,<br>                            &quot;url&quot;: job_url<br>                        })<br>                        <br>                    except Exception as e:<br>                        logging.warning(f&quot;Failed to extract job: {str(e)}&quot;)<br>                        continue<br>                <br>            except Exception as e:<br>                logging.error(f&quot;Failed to scrape page {page}: {str(e)}&quot;)<br>                continue<br>    <br>    return jobs</pre><h3>Why CDP Mode Works</h3><p><strong>Traditional Selenium:</strong></p><p>javascript</p><pre>// What websites detect<br>window.navigator.webdriver === true</pre><p><strong>SeleniumBase CDP Mode:</strong></p><p>javascript</p><pre>// Undetected!<br>window.navigator.webdriver === undefined</pre><p><strong>Key advantages:</strong></p><ol><li>No Selenium footprints</li><li>Native Chrome automation</li><li>Stealth by default</li><li>Better performance</li></ol><p>&lt;a name=”frontend”&gt;&lt;/a&gt;</p><h3>6. Frontend: React Dashboard</h3><h3>Component Architecture</h3><pre>src/<br>├── components/<br>│   ├── JobScraper.js      # Search form<br>│   ├── JobTable.js        # Results display<br>│   ├── Analytics.js       # Statistics<br>│   └── DownloadButtons.js # Export functionality<br>├── services/<br>│   └── api.js             # API client<br>├── App.js                 # Main component<br>└── index.js               # Entry point</pre><h3>The Search Form Component</h3><p><strong>JobScraper.js:</strong></p><p>javascript</p><pre>import React, { useState } from &#39;react&#39;;<br>import api from &#39;../services/api&#39;;</pre><pre>const JobScraper = ({ onResults }) =&gt; {<br>  const [formData, setFormData] = useState({<br>    jobTitle: &#39;&#39;,<br>    location: &#39;&#39;,<br>    pages: 1<br>  });<br>  const [loading, setLoading] = useState(false);<br>  const [error, setError] = useState(null);</pre><pre>  const handleSubmit = async (e) =&gt; {<br>    e.preventDefault();<br>    setLoading(true);<br>    setError(null);</pre><pre>    try {<br>      const response = await api.scrapeJobs({<br>        job_title: formData.jobTitle,<br>        location: formData.location,<br>        pages: formData.pages<br>      });<br>      <br>      onResults(response.data);<br>    } catch (err) {<br>      setError(err.message);<br>    } finally {<br>      setLoading(false);<br>    }<br>  };</pre><pre>  return (<br>    &lt;form onSubmit={handleSubmit} className=&quot;scraper-form&quot;&gt;<br>      &lt;div className=&quot;form-group&quot;&gt;<br>        &lt;label&gt;Job Title *&lt;/label&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          value={formData.jobTitle}<br>          onChange={(e) =&gt; setFormData({...formData, jobTitle: e.target.value})}<br>          placeholder=&quot;e.g., Software Engineer&quot;<br>          required<br>        /&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;form-group&quot;&gt;<br>        &lt;label&gt;Location&lt;/label&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          value={formData.location}<br>          onChange={(e) =&gt; setFormData({...formData, location: e.target.value})}<br>          placeholder=&quot;e.g., Remote&quot;<br>        /&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;form-group&quot;&gt;<br>        &lt;label&gt;Pages to Scrape&lt;/label&gt;<br>        &lt;input<br>          type=&quot;number&quot;<br>          min=&quot;1&quot;<br>          max=&quot;10&quot;<br>          value={formData.pages}<br>          onChange={(e) =&gt; setFormData({...formData, pages: parseInt(e.target.value)})}<br>        /&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;button type=&quot;submit&quot; disabled={loading}&gt;<br>        {loading ? &#39;🔄 SCRAPING...&#39; : &#39;🚀 START SCRAPING&#39;}<br>      &lt;/button&gt;<br>      <br>      {error &amp;&amp; &lt;div className=&quot;error&quot;&gt;{error}&lt;/div&gt;}<br>    &lt;/form&gt;<br>  );<br>};</pre><pre>export default JobScraper;</pre><h3>The Results Table</h3><p><strong>JobTable.js:</strong></p><p>javascript</p><pre>import React, { useState } from &#39;react&#39;;</pre><pre>const JobTable = ({ jobs }) =&gt; {<br>  const [filter, setFilter] = useState(&#39;&#39;);</pre><pre>  const filteredJobs = jobs.filter(job =&gt;<br>    job.title.toLowerCase().includes(filter.toLowerCase()) ||<br>    job.company.toLowerCase().includes(filter.toLowerCase()) ||<br>    job.location.toLowerCase().includes(filter.toLowerCase())<br>  );</pre><pre>  return (<br>    &lt;div className=&quot;job-table-container&quot;&gt;<br>      &lt;div className=&quot;filter-section&quot;&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          placeholder=&quot;🔍 Filter jobs by title, company, or location...&quot;<br>          value={filter}<br>          onChange={(e) =&gt; setFilter(e.target.value)}<br>          className=&quot;filter-input&quot;<br>        /&gt;<br>      &lt;/div&gt;</pre><pre>      &lt;table className=&quot;job-table&quot;&gt;<br>        &lt;thead&gt;<br>          &lt;tr&gt;<br>            &lt;th&gt;#&lt;/th&gt;<br>            &lt;th&gt;Job Title&lt;/th&gt;<br>            &lt;th&gt;Company&lt;/th&gt;<br>            &lt;th&gt;Location&lt;/th&gt;<br>            &lt;th&gt;Action&lt;/th&gt;<br>          &lt;/tr&gt;<br>        &lt;/thead&gt;<br>        &lt;tbody&gt;<br>          {filteredJobs.map((job, index) =&gt; (<br>            &lt;tr key={job.url}&gt;<br>              &lt;td&gt;{index + 1}&lt;/td&gt;<br>              &lt;td&gt;{job.title}&lt;/td&gt;<br>              &lt;td&gt;{job.company}&lt;/td&gt;<br>              &lt;td&gt;{job.location}&lt;/td&gt;<br>              &lt;td&gt;<br>                &lt;a href={job.url} target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;<br>                  &lt;button className=&quot;view-btn&quot;&gt;VIEW JOB&lt;/button&gt;<br>                &lt;/a&gt;<br>              &lt;/td&gt;<br>            &lt;/tr&gt;<br>          ))}<br>        &lt;/tbody&gt;<br>      &lt;/table&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><pre>export default JobTable;</pre><p>&lt;a name=”anti-bot”&gt;&lt;/a&gt;</p><h3>7. Overcoming Anti-Bot Detection</h3><p>This was the biggest challenge. Indeed implements multiple layers of protection:</p><h3>Anti-Bot Mechanisms</h3><ol><li><strong>Browser Fingerprinting</strong></li></ol><ul><li>User agent detection</li><li>Screen resolution tracking</li><li>Plugin enumeration</li><li>Canvas fingerprinting</li></ul><ol><li><strong>Behavioral Analysis</strong></li></ol><ul><li>Mouse movement patterns</li><li>Typing speed</li><li>Click patterns</li><li>Scroll behavior</li></ul><ol><li><strong>JavaScript Challenges</strong></li></ol><ul><li>Captchas</li><li>Proof-of-work challenges</li><li>Token generation</li></ul><ol><li><strong>Rate Limiting</strong></li></ol><ul><li>IP-based throttling</li><li>Request frequency monitoring</li></ul><h3>My Solution</h3><p><strong>SeleniumBase CDP Mode solves these problems:</strong></p><p>python</p><pre># The magic configuration<br>with SB(uc=True, headless=True) as sb:<br>    # uc=True enables undetected mode<br>    # headless=True for background operation</pre><p><strong>What happens under the hood:</strong></p><p><strong>1.Undetected Chrome Driver</strong></p><ul><li>Removes navigator.webdriver flag</li><li>Patches Chrome DevTools detection</li><li>Mimics real browser behavior</li></ul><p><strong>2.CDP (Chrome DevTools Protocol)</strong></p><ul><li>Direct browser communication</li><li>No Selenium detection vectors</li><li>Native automation capabilities</li></ul><p><strong>3. Smart Waiting</strong></p><p>python</p><pre>sb.wait_for_element(&quot;.job_seen_beacon&quot;, timeout=10)</pre><ul><li>Waits for dynamic content</li><li>Handles AJAX requests</li><li>Prevents premature scraping</li></ul><ol><li><strong>Error Handling</strong></li></ol><p>python</p><pre>try:<br>       # Scraping logic<br>   except Exception as e:<br>       logging.warning(f&quot;Retrying...&quot;)<br>       continue</pre><p><strong>Success Rate: 100%</strong> ✅</p><p>&lt;a name=”data-export”&gt;&lt;/a&gt;</p><h3>8. Data Export &amp; Analytics</h3><h3>Export Functionality</h3><p><strong>utils.py:</strong></p><p>python</p><pre>import csv<br>import json<br>import pandas as pd<br>from io import StringIO, BytesIO</pre><pre>def export_to_csv(jobs: list) -&gt; str:<br>    &quot;&quot;&quot;Export jobs to CSV format&quot;&quot;&quot;<br>    output = StringIO()<br>    writer = csv.DictWriter(output, fieldnames=[&#39;title&#39;, &#39;company&#39;, &#39;location&#39;, &#39;url&#39;])<br>    writer.writeheader()<br>    writer.writerows(jobs)<br>    return output.getvalue()</pre><pre>def export_to_excel(jobs: list) -&gt; bytes:<br>    &quot;&quot;&quot;Export jobs to Excel format&quot;&quot;&quot;<br>    df = pd.DataFrame(jobs)<br>    output = BytesIO()<br>    df.to_excel(output, index=False, engine=&#39;openpyxl&#39;)<br>    return output.getvalue()</pre><pre>def export_to_json(jobs: list) -&gt; str:<br>    &quot;&quot;&quot;Export jobs to JSON format&quot;&quot;&quot;<br>    return json.dumps(jobs, indent=2)</pre><h3>Analytics Dashboard</h3><p><strong>Real-time metrics computed:</strong></p><p>python</p><pre>def calculate_analytics(jobs: list) -&gt; dict:<br>    &quot;&quot;&quot;Calculate job market insights&quot;&quot;&quot;<br>    <br>    companies = [job[&#39;company&#39;] for job in jobs]<br>    locations = [job[&#39;location&#39;] for job in jobs]<br>    <br>    return {<br>        &#39;total_jobs&#39;: len(jobs),<br>        &#39;unique_companies&#39;: len(set(companies)),<br>        &#39;unique_locations&#39;: len(set(locations)),<br>        &#39;top_companies&#39;: Counter(companies).most_common(3),<br>        &#39;top_locations&#39;: Counter(locations).most_common(5),<br>        &#39;remote_jobs&#39;: sum(1 for loc in locations if &#39;remote&#39; in loc.lower())<br>    }</pre><p><strong>Frontend Analytics Display:</strong></p><p>javascript</p><pre>const Analytics = ({ data }) =&gt; (<br>  &lt;div className=&quot;analytics-dashboard&quot;&gt;<br>    &lt;div className=&quot;stat-card&quot;&gt;<br>      &lt;h3&gt;📊 Jobs Found&lt;/h3&gt;<br>      &lt;p className=&quot;stat-number&quot;&gt;{data.total}&lt;/p&gt;<br>    &lt;/div&gt;<br>    <br>    &lt;div className=&quot;stat-card&quot;&gt;<br>      &lt;h3&gt;🏢 Unique Companies&lt;/h3&gt;<br>      &lt;p className=&quot;stat-number&quot;&gt;{data.unique_companies}&lt;/p&gt;<br>    &lt;/div&gt;<br>    <br>    &lt;div className=&quot;stat-card&quot;&gt;<br>      &lt;h3&gt;📍 Unique Locations&lt;/h3&gt;<br>      &lt;p className=&quot;stat-number&quot;&gt;{data.unique_locations}&lt;/p&gt;<br>    &lt;/div&gt;<br>    <br>    &lt;div className=&quot;stat-card&quot;&gt;<br>      &lt;h3&gt;🌐 Remote Jobs&lt;/h3&gt;<br>      &lt;p className=&quot;stat-number&quot;&gt;{data.remote_jobs}&lt;/p&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>);</pre><p>&lt;a name=”challenges”&gt;&lt;/a&gt;</p><h3>9. Challenges &amp; Solutions</h3><h3>Challenge 1: Inconsistent HTML Structure</h3><p><strong>Problem:</strong></p><p>html</p><pre>&lt;!-- Sometimes job title is here --&gt;<br>&lt;h2 class=&quot;jobTitle&quot;&gt;<br>  &lt;span&gt;Software Engineer&lt;/span&gt;<br>&lt;/h2&gt;</pre><pre>&lt;!-- Other times it&#39;s here --&gt;<br>&lt;h2 class=&quot;jobTitle&quot;&gt;<br>  &lt;a&gt;&lt;span&gt;Software Engineer&lt;/span&gt;&lt;/a&gt;<br>&lt;/h2&gt;</pre><p><strong>Solution:</strong></p><p>python</p><pre>def safe_extract_text(element, selector):<br>    &quot;&quot;&quot;Safely extract text from element&quot;&quot;&quot;<br>    try:<br>        el = element.find_element(selector)<br>        return el.text.strip()<br>    except:<br>        # Try alternate selectors<br>        alternates = [f&quot;{selector} span&quot;, f&quot;{selector} a span&quot;]<br>        for alt in alternates:<br>            try:<br>                return element.find_element(alt).text.strip()<br>            except:<br>                continue<br>        return &quot;N/A&quot;</pre><h3>Challenge 2: Rate Limiting</h3><p><strong>Problem:</strong> Too many requests triggered IP blocks</p><p><strong>Solution:</strong></p><p>python</p><pre>import time<br>import random</pre><pre>def scrape_with_delays(pages):<br>    for page in range(pages):<br>        scrape_page(page)<br>        # Random delay between 2-5 seconds<br>        time.sleep(random.uniform(2, 5))</pre><h3>Challenge 3: Dynamic Content Loading</h3><p><strong>Problem:</strong> Jobs loaded via JavaScript after page load</p><p><strong>Solution:</strong></p><p>python</p><pre># Wait for specific elements<br>sb.wait_for_element(&quot;.job_seen_beacon&quot;, timeout=10)</pre><pre># Or wait for network idle<br>sb.wait_for_ready_state_complete()</pre><pre># Or custom wait<br>sb.wait_for(lambda: len(sb.find_elements(&quot;.job_seen_beacon&quot;)) &gt; 0)</pre><h3>Challenge 4: Memory Management</h3><p><strong>Problem:</strong> Browser instances consuming too much RAM</p><p><strong>Solution:</strong></p><p>python</p><pre># Use context manager for automatic cleanup<br>with SB(uc=True, headless=True) as sb:<br>    # Scraping code<br>    pass  # Browser automatically closes here</pre><pre># Clear data between pages<br>sb.clear_cookies()<br>sb.clear_local_storage()</pre><p>&lt;a name=”results”&gt;&lt;/a&gt;</p><h3>10. Results &amp; Performance</h3><h3>Performance Metrics</h3><pre>MetricResultJobs per page15-20Time per page5-7 secondsSuccess rate100%Link validation100%Memory usage~300MBCPU usage15-25%</pre><h3>Real-World Testing</h3><p><strong>Test Case 1:</strong> Software Engineer, Remote</p><ul><li>Pages: 5</li><li>Time: 32 seconds</li><li>Jobs: 87</li><li>Companies: 64</li><li>Success: ✅</li></ul><p><strong>Test Case 2:</strong> Marketing Manager, New York</p><ul><li>Pages: 3</li><li>Time: 18 seconds</li><li>Jobs: 45</li><li>Companies: 38</li><li>Success: ✅</li></ul><p><strong>Test Case 3:</strong> Data Scientist, San Francisco</p><ul><li>Pages: 10</li><li>Time: 68 seconds</li><li>Jobs: 176</li><li>Companies: 132</li><li>Success: ✅</li></ul><h3>Scalability</h3><p><strong>Single instance can handle:</strong></p><ul><li>✅ 1–10 concurrent users</li><li>✅ 500+ jobs per session</li><li>✅ Multiple searches simultaneously</li><li>✅ All export formats</li></ul><p><strong>For higher scale:</strong></p><ul><li>Add Redis for caching</li><li>Implement queue system (Celery)</li><li>Use load balancer</li><li>Deploy on cloud (AWS/GCP)</li></ul><p>&lt;a name=”future”&gt;&lt;/a&gt;</p><h3>11. Future Improvements</h3><h3>Phase 1 (Next Month)</h3><ul><li><strong>User Authentication</strong></li><li>Save searches</li><li>Personal dashboard</li><li>Search history</li><li><strong>Email Notifications</strong></li><li>Daily job alerts</li><li>New matches</li><li>Company updates</li></ul><h3>Phase 2 (Q4 2025)</h3><ul><li><strong>Multi-Platform Support</strong></li><li>LinkedIn integration</li><li>Glassdoor scraping</li><li>Monster.com support</li><li><strong>Advanced Filtering</strong></li><li>Salary range</li><li>Job type (full-time, contract)</li><li>Experience level</li><li>Company size</li></ul><h3>Phase 3 (2026)</h3><ul><li><strong>Machine Learning</strong></li><li>Job recommendations</li><li>Salary prediction</li><li>Skills matching</li><li>Resume optimization</li><li><strong>Database Integration</strong></li><li>PostgreSQL for storage</li><li>Historical tracking</li><li>Trend analysis</li><li>Market insights</li></ul><h3>Phase 4 (Future)</h3><ul><li><strong>Mobile App</strong></li><li>iOS application</li><li>Android application</li><li>Push notifications</li><li><strong>API Marketplace</strong></li><li>Public API access</li><li>Premium features</li><li>Developer tools</li></ul><p>&lt;a name=”takeaways”&gt;&lt;/a&gt;</p><h3>12. Key Takeaways</h3><h3>Technical Lessons</h3><p><strong>1. FastAPI is Production-Ready</strong></p><ul><li>10x faster than alternatives</li><li>Automatic documentation</li><li>Type safety prevents bugs</li><li>Async support is game-changing</li></ul><p><strong>2. SeleniumBase CDP Mode is Reliable</strong></p><ul><li>Bypasses detection consistently</li><li>Easier than raw Selenium</li><li>Built-in anti-bot features</li><li>Great for modern websites</li></ul><p><strong>3. React Component Architecture Scales</strong></p><ul><li>Easy to maintain</li><li>Reusable components</li><li>Clear data flow</li><li>Great developer experience</li></ul><p><strong>4. Type Safety Matters</strong></p><ul><li>Pydantic caught 20+ bugs</li><li>Clear API contracts</li><li>Better IDE support</li><li>Easier debugging</li></ul><h3>Development Insights</h3><p><strong>What Worked:</strong> ✅ Starting with MVP ✅ Incremental feature addition ✅ Comprehensive error handling ✅ Regular testing ✅ Good documentation</p><p><strong>What I’d Do Differently:</strong></p><ul><li>Add database from start</li><li>Implement caching earlier</li><li>Write more tests</li><li>Use Docker from day one</li><li>Set up CI/CD pipeline</li></ul><h3>Business Lessons</h3><p><strong>Problem Validation:</strong></p><ul><li>Talked to 10 job seekers</li><li>All wanted automation</li><li>Willing to pay for premium</li><li>Clear market need</li></ul><p><strong>User Feedback:</strong></p><ul><li>Requested LinkedIn support</li><li>Want salary filtering</li><li>Need email alerts</li><li>Love the analytics</li></ul><h3>Conclusion</h3><p>Building this job scraper taught me more than any tutorial could. I learned about:</p><ul><li>Modern API development</li><li>Advanced web scraping</li><li>Frontend architecture</li><li>Overcoming technical challenges</li><li>User-centered design</li></ul><p><strong>The Numbers:</strong></p><ul><li>3 weeks development</li><li>2,500+ lines of code</li><li>100% success rate</li><li>Countless hours saved for users</li></ul><p><strong>Most Importantly:</strong> This project solved a real problem for real people.</p><h3>Resources &amp; Links</h3><p><strong>🔗 Project Links:</strong></p><ul><li>GitHub: <a href="https://github.com/seotanvirbd/indeed_fastapi_reactjs_scraper_app">https://github.com/seotanvirbd/indeed_fastapi_reactjs_scraper_app</a></li></ul><p><strong>📚 Technologies Used:</strong></p><ul><li><a href="https://fastapi.tiangolo.com/">FastAPI</a></li><li><a href="https://react.dev/">React</a></li><li><a href="https://seleniumbase.io/">SeleniumBase</a></li><li><a href="https://docs.pydantic.dev/">Pydantic</a></li></ul><p><strong>🎓 Learning Resources:</strong></p><ul><li><a href="https://fastapi.tiangolo.com/tutorial/">FastAPI Tutorial</a></li><li><a href="https://react.dev/learn">React Docs</a></li><li><a href="https://towardsdatascience.com/ethics-in-web-scraping-b96b18136f01">Web Scraping Ethics</a></li></ul><h3>Connect With Me</h3><p>If you found this helpful or have questions:</p><ul><li><strong>GitHub:</strong> <a href="https://github.com/seotanvirbd">@seotanvirbd</a></li><li><strong>LinkedIn:</strong> <a href="https://www.linkedin.com/in/seotanvirbd/">Mohammad Tanvir</a></li><li><strong>Email:</strong> tanvirafra1@gmail.com</li><li><strong>Portfolio:</strong> <a href="https://seotanvirbd.com/portfolio/">https://seotanvirbd.com/portfolio/</a></li></ul><p>⭐ <strong>Star the repo if you found this useful!</strong></p><p>💬 <strong>Drop your questions in the comments below</strong></p><p>🔔 <strong>Follow for more full-stack projects</strong></p><h3>Tags</h3><p>#WebDevelopment #Python #React #FastAPI #WebScraping #SeleniumBase #FullStack #JavaScript #API #Automation #JobSearch #Career #Technology #Programming #SoftwareEngineering #Tutorial #OpenSource</p><p><em>Thanks for reading! This article took me week to write. If you learned something, please clap 👏 and share with others who might find it useful.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22e53d09147c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Struggling with dynamic content that traditional scrapers can’t handle?]]></title>
            <link>https://medium.com/@seotanvirbd/struggling-with-dynamic-content-that-traditional-scrapers-cant-handle-fe66c861ee26?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe66c861ee26</guid>
            <category><![CDATA[python-webscraping]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 16:47:36 GMT</pubDate>
            <atom:updated>2025-08-28T16:47:36.722Z</atom:updated>
            <content:encoded><![CDATA[<p>Struggling with dynamic content that traditional scrapers can’t handle? Playwright is a game-changer. 🚀</p><p>Unlike simpler tools, it automates real browsers, perfectly rendering JavaScript-heavy sites. This means you can reliably scrape data from modern web apps like React, Vue.js, or Angular.</p><p>My top tip: Always use explicit waits (`page.wait_for_selector()`) instead of arbitrary `time.sleep()` calls. This makes your scripts faster and far more robust against network delays or layout shifts.</p><p>It’s this attention to reliable, clean data delivery that has helped me complete 50+ projects for repeat clients on Upwork.</p><p>#WebScraping #Playwright</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe66c861ee26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon Scraping via Browser Console | Export JSON, CSV, XLSX]]></title>
            <link>https://medium.com/@seotanvirbd/amazon-scraping-via-browser-console-export-json-csv-xlsx-3877b835f0b0?source=rss-fd5b347e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3877b835f0b0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[lead-generation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[SEO Tanvir BD]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 16:41:53 GMT</pubDate>
            <atom:updated>2025-08-15T16:41:53.527Z</atom:updated>
            <content:encoded><![CDATA[<p>Step-by-step guide to scrape Amazon using browser console JS, export JSON/CSV/Excel, plus video tutorial included.</p><h3><strong>Why scraping Amazon via browser console is smart &amp; safe ?</strong></h3><p>Avoid complex setups — and potential bans — with a manual yet powerful method: execute JavaScript in your browser console to extract Amazon product data. You’ll export instantly to JSON, CSV, or Excel — all in a few lines of code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJqp7GOzF6hU%3Fstart%3D494%26feature%3Doembed%26start%3D494&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJqp7GOzF6hU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJqp7GOzF6hU%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c1051f76d693332fb39d239f3ecba83c/href">https://medium.com/media/c1051f76d693332fb39d239f3ecba83c/href</a></iframe><h3>Step-by-Step Walkthrough (H2):</h3><h4>Step 1: Load your search page on Amazon</h4><p>Scroll through your search results, ensuring enough products are visible.</p><h4>Step 2: Open browser console</h4><ul><li>Chrome/Edge: Ctrl + Shift + J (Win) or Cmd + Option + J (Mac)</li><li>Firefox: Ctrl + Shift + K (Win) or Cmd + Option + K (Mac)</li></ul><h4>Step 3: Paste the scraping script</h4><pre>function scrapeAmazonProducts() {<br>  const products = [];<br>  document.querySelectorAll(&#39;[data-component-type=&quot;s-search-result&quot;]&#39;).forEach(container =&gt; {<br>    const product = {<br>      title: container.querySelector(&#39;h2 a span&#39;)?.textContent.trim() || &#39;N/A&#39;,<br>      url: &#39;https://amazon.com&#39; + (container.querySelector(&#39;h2 a&#39;)?.href || &#39;&#39;),<br>      asin: container.getAttribute(&#39;data-asin&#39;) || &#39;N/A&#39;,<br>      price: container.querySelector(&#39;.a-price .a-offscreen&#39;)?.textContent.trim() || &#39;N/A&#39;,<br>      rating: container.querySelector(&#39;.a-icon-alt&#39;)?.textContent.trim() || &#39;N/A&#39;,<br>      reviewCount: container.querySelector(&#39;[aria-label*=&quot;ratings&quot;], a[href*=&quot;#customerReviews&quot;] span&#39;)?.textContent.trim() || &#39;N/A&#39;,<br>      imageUrl: container.querySelector(&#39;.s-image&#39;)?.src || &#39;N/A&#39;<br>    };<br>    product.title !== &#39;N/A&#39; &amp;&amp; product.asin !== &#39;N/A&#39; &amp;&amp; products.push(product);<br>  });<br>  return products;<br>}<br>const scrapedProducts = scrapeAmazonProducts();<br>console.table(scrapedProducts);</pre><h4>Step 4: Add the export utility</h4><p>Paste the contents of your utils.js—you can find it in the GitHub repo—to enable:</p><pre>exportData(scrapedProducts, &quot;amazon_products&quot;);</pre><p>This downloads JSON, CSV, and XLSX versions automatically.</p><h3>Why This Works :</h3><ul><li>Runs entirely in-browser — no external requests, no risk of IP bans.</li><li>Amazon page is loaded normally, so you’re scraping what you see.</li><li>Fast, safe, and ideal for quick product data extraction.</li></ul><h3>Conclusion &amp; Next Steps (H2):</h3><p>You now have a <strong>simple, safe, and fast way</strong> to scrape Amazon right from your browser console and export structured data instantly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3877b835f0b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>