<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: baochouu08</title>
    <description>The latest articles on DEV Community by baochouu08 (@baochouu08).</description>
    <link>https://dev.to/baochouu08</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3635712%2Fc00cf33f-58db-422b-a3b1-9b23f437c8f4.png</url>
      <title>DEV Community: baochouu08</title>
      <link>https://dev.to/baochouu08</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/baochouu08"/>
    <language>en</language>
    <item>
      <title>How to Scrape Free SMS Verification Codes using Python (Under 10 Lines)</title>
      <dc:creator>baochouu08</dc:creator>
      <pubDate>Sat, 29 Nov 2025 07:18:51 +0000</pubDate>
      <link>https://dev.to/baochouu08/how-to-scrape-free-sms-verification-codes-using-python-under-10-lines-3kam</link>
      <guid>https://dev.to/baochouu08/how-to-scrape-free-sms-verification-codes-using-python-under-10-lines-3kam</guid>
      <description>&lt;p&gt;As a developer, I often need to test SMS verification flows (OTP) for my apps. Buying SIM cards is expensive, and paid APIs like Twilio can be overkill for simple testing.&lt;/p&gt;

&lt;p&gt;I recently found a way to automate this using a fast, free public SMS receiver service. In this tutorial, I'll show you how to build a simple &lt;strong&gt;Python SMS Scraper&lt;/strong&gt; that fetches virtual phone numbers and reads verification codes in real-time.&lt;/p&gt;

&lt;p&gt;The source I'm using is &lt;strong&gt;&lt;a href="https://receivesms.me" rel="noopener noreferrer"&gt;Receivesms.me&lt;/a&gt;&lt;/strong&gt; because their backend is incredibly fast (responds in &amp;lt; 0.8s) and has zero ads blocking the HTML structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Prerequisites
&lt;/h2&gt;

&lt;p&gt;You only need Python 3 and the &lt;code&gt;requests&lt;/code&gt; library:&lt;br&gt;
pip install requests&lt;/p&gt;

&lt;h2&gt;
  
  
  💻 The Script
&lt;/h2&gt;

&lt;p&gt;Here is a simple wrapper I wrote. It simulates a browser request to fetch available numbers from the USA node.&lt;br&gt;
import requests&lt;br&gt;
import redef get_latest_sms(phone_number):&lt;/p&gt;

&lt;h1&gt;
  
  
  This is a simplified example.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  For the full async implementation, check the GitHub repo below.
&lt;/h1&gt;

&lt;p&gt;url = f"&lt;a href="https://receivesms.me/number/%7Bphone_number%7D%22headers" rel="noopener noreferrer"&gt;https://receivesms.me/number/{phone_number}"headers&lt;/a&gt; = {&lt;br&gt;
    'User-Agent': 'Mozilla/5.0 (Compatible; Python-SMS-Client/1.0)'&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;try:&lt;br&gt;
    response = requests.get(url, headers=headers)&lt;br&gt;
    if response.status_code == 200:&lt;br&gt;
        # Extract OTP using Regex (adjust based on your service)&lt;br&gt;
        otp_pattern = r'\bd{6}\b' &lt;br&gt;
        codes = re.findall(otp_pattern, response.text)&lt;br&gt;
        return list(set(codes)) # Return unique codes found&lt;br&gt;
except Exception as e:&lt;br&gt;
    print(f"Error fetching SMS: {e}")&lt;br&gt;
    return []Example Usageif name == "main":&lt;/p&gt;

&lt;h1&gt;
  
  
  You can grab a fresh number from the homepage
&lt;/h1&gt;

&lt;p&gt;test_number = "1234567890"&lt;br&gt;
print(f"Checking SMS for {test_number}...")codes = get_latest_sms(test_number)&lt;br&gt;
print(f"Found verification codes: {codes}")&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Why build your own wrapper?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;It's Free:&lt;/strong&gt; Most "SMS API" services charge per message. Scraping public nodes is free.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Unlimited Testing:&lt;/strong&gt; You can rotate through 44+ countries (US, UK, Vietnam, etc.) without limits.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Privacy:&lt;/strong&gt; You don't need to register an account or provide your credit card.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  📦 Source Code
&lt;/h2&gt;

&lt;p&gt;I have published a more robust, asynchronous version of this tool on GitHub. It handles connection pooling and supports multi-country fetching.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://github.com/baochouu08/python-receive-sms-online-api" rel="noopener noreferrer"&gt;View GitHub Repository&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🔗 Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Live Demo / Data Source:&lt;/strong&gt; &lt;a href="https://receivesms.me" rel="noopener noreferrer"&gt;Receivesms.me&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Python Requests Docs:&lt;/strong&gt; &lt;a href="https://docs.python-requests.org/" rel="noopener noreferrer"&gt;Requests: HTTP for Humans&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hope this script saves you some time (and money) on your next project! Happy coding! 👨‍💻&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>python</category>
      <category>sms</category>
    </item>
  </channel>
</rss>
