<?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 priyanka prabhu on Medium]]></title>
        <description><![CDATA[Stories by priyanka prabhu on Medium]]></description>
        <link>https://medium.com/@vpriyankaprabhu?source=rss-1c36e7bb3532------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6-IMtVpBTO4E0Mz4.jpg</url>
            <title>Stories by priyanka prabhu on Medium</title>
            <link>https://medium.com/@vpriyankaprabhu?source=rss-1c36e7bb3532------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:24:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vpriyankaprabhu/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[Clinic Bot: Exploring Function Calling and Regex in Chatbot Design]]></title>
            <link>https://medium.com/@vpriyankaprabhu/clinic-bot-exploring-function-calling-and-regex-in-chatbot-design-cab1380ce9eb?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/cab1380ce9eb</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[regex]]></category>
            <category><![CDATA[openai-function-calling]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Sun, 25 May 2025 16:56:20 GMT</pubDate>
            <atom:updated>2025-05-25T16:57:13.578Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mdsSwJCEWI5nJjtDj7aIvA.png" /><figcaption>Clinic Bot</figcaption></figure><p>Have you ever chatted with an AI and thought:<br> <strong>“This is cool… but can it <em>do</em> something useful?”</strong></p><p>That’s the idea behind the doctor-super-clinic-bot — a Python-based chatbot that doesn’t just talk. It can <strong>understand symptoms, find the right doctor, show available slots, and even book an appointment.</strong> All through a simple conversation.</p><p>In this post, I’ll walk you through two versions of the bot — one powered by <strong>OpenAI’s function calling</strong> and the other by <strong>good-old regex rules</strong> — and show how even beginner coders can build practical AI assistants.</p><h3>Without Function Calling: It Just Talks</h3><p>The model reads your message and responds with text.</p><p>Example:</p><blockquote><em>You: </em>I have a headache<em><br> Bot: </em>You should see a neurologist.</blockquote><p>That’s it. It doesn’t query a database. It doesn’t book anything. It’s just guessing based on training.</p><p>Simple and fast — but doesn’t provide any details further.</p><h3>With Function Calling: It Actually Does Things</h3><p>In most chatbots, the AI just replies with helpful text. That’s great — but sometimes we want more than replies. We want <strong>real actions</strong>.</p><p>That’s where <strong>function calling</strong> comes in.</p><p>Now imagine this:</p><blockquote><em>You: </em>I have a rash<em><br> Bot: </em>Let me check for dermatologists near you…<em><br> </em>(calls a function, fetches real data, displays slots)</blockquote><p>In this setup, GPT decides <em>when</em> to call a function (like find_doctor_by_specialty) and <em>what arguments</em> to pass — all structured in JSON. Your backend just needs to handle it.</p><p>Suddenly, your chatbot is <strong>not just chatting — it’s helping.</strong></p><h3>Inside the Project: Two Bots, Two Styles</h3><p>The <a href="https://github.com/vpriyankaprabhu/doctor-super-clinic-bot">doctor-super-clinic-bot</a> GitHub repo includes <strong>two versions</strong>, each teaching a different approach.</p><h3>app-without-functioncalling.py — Simple, Rule-Based Chat</h3><ul><li>Works purely through natural replies</li><li>No backend calls or logic execution</li><li>Easy to build and test</li><li>Great for beginners exploring how GPT forms responses</li></ul><h3>app.py — Smart Assistant with Function Calling</h3><ul><li>Uses OpenAI’s function calling feature</li><li>Returns structured JSON when action is needed</li><li>Executes real backend logic (e.g., search MongoDB, book appointments)</li><li>Feels like a true assistant</li></ul><h3>How the Flow Works (With Function Calling)</h3><ol><li>User: <em>I have a toothache</em></li><li>GPT infers: → needs a <strong>Dentist</strong></li><li>GPT returns a function call:</li></ol><pre>{<br>  &quot;name&quot;: &quot;find_doctor_by_specialty&quot;,<br>  &quot;arguments&quot;: {<br>    &quot;specialty&quot;: &quot;Dentist&quot;<br>  }<br>}</pre><p>Your Python code runs the function, pulls doctor data from MongoDB, and replies with available slots.</p><p>User picks a time → GPT calls book_appointment()</p><h3>Tech Stack</h3><ul><li><strong>Python (CLI-based)</strong> — lightweight and terminal-friendly</li><li><strong>MongoDB</strong> — stores doctor data and appointments</li><li><strong>OpenAI GPT-4 API</strong> — for intelligent responses</li><li><strong>Regex</strong> — in the fallback simpler version</li></ul><h3>Try It Yourself!</h3><p>Want to test both bots locally?</p><h3>Step 1: Clone the Repo</h3><pre>git clone https://github.com/vpriyankaprabhu/doctor-super-clinic-bot<br>cd doctor-super-clinic-bot</pre><h3>Step 2: Install Requirements</h3><pre>pip install -r requirements.txt</pre><h3>Step 3: Run the Bots</h3><pre>python app.py                          # With function calling<br>python app-without-functioncalling.py  # Classic GPT replies only</pre><h3>Final Thoughts</h3><p>Function calling unlocks a whole new level of chatbot intelligence.</p><p>It takes your AI from:</p><blockquote><em>“Let me </em>tell<em> you what to do”<br> to<br> “Let me </em>do<em> it for you”</em></blockquote><p>Whether you’re building for a clinic, a personal assistant, or just exploring Generative AI — understanding function calling is a <strong>power move</strong>.</p><h3>Explore the Code</h3><p><a href="https://github.com/vpriyankaprabhu/doctor-super-clinic-bot">GitHub - vpriyankaprabhu/doctor-super-clinic-bot: A Simple chatbot application with Python and GPT LLM model</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cab1380ce9eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are Tokens?! Learn How Language Models Read Sentences Behind the Scenes]]></title>
            <link>https://medium.com/@vpriyankaprabhu/what-are-tokens-learn-how-language-models-read-sentences-behind-the-scenes-fd8db66651c3?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd8db66651c3</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Fri, 25 Apr 2025 04:09:02 GMT</pubDate>
            <atom:updated>2025-04-25T04:25:28.791Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered how AI chatbots like ChatGPT understand your messages? Before they generate a single word, it has to understand and process your text/sentence — <strong>it doesn’t “see” words the way you and I do</strong>. They first break text down into smaller pieces called “tokens.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5HCVW_oBivt6QPTM7AE7lw.jpeg" /><figcaption>Tokenization</figcaption></figure><p>Let’s explore what tokenization means and why it matters.</p><p>We’ll even build a simple interactive app (like OpenAI’s <a href="https://tiktokenizer.vercel.app/?model=cl100k_base">tiktokenizer</a>) to <strong>see exactly how language models breaks your sentence apart.</strong></p><p>Each of those chunks is a token. And each one has a corresponding <strong>token ID</strong> — a number the model understands.</p><h3>Understanding Tokenization (Simple Examples)</h3><p><strong>Tokenization</strong> is the process of splitting text into smaller pieces called <strong><em>tokens</em></strong>. These tokens are what language models like GPT use to understand and process language.</p><h4>🔹 Example 1: Word Tokenization</h4><pre>Text: &quot;I love pizza.&quot;<br>Tokens: [&quot;I&quot;, &quot;love&quot;, &quot;pizza&quot;, &quot;.&quot;]</pre><blockquote>This is common in older NLP systems.</blockquote><h4>🔹 Example 2: Subword Tokenization (like in GPT)</h4><pre>Text: &quot;Tokenization&quot;<br>Tokens: [&quot;Token&quot;, &quot;ization&quot;]</pre><pre>Text: &quot;happiness&quot;<br>Tokens: [&quot;h&quot;, &quot;appiness&quot;]</pre><blockquote>GPT tokenizers often use subword-level tokenization so even unfamiliar words can be broken down into meaningful parts/tokens.</blockquote><h4>🔹 Example 3: Real GPT-2 Tokenization</h4><p>Let’s see tokenization in action with a basic example — Using the tiktoken tokenizer from OpenAI:</p><pre>import tiktoken<br><br>enc = tiktoken.get_encoding(&quot;gpt2&quot;)<br>tokens = enc.encode(&quot;Hello World !&quot;)<br>print(tokens)  # Output: [15496, 2159, 5145]<br>print([enc.decode([t]) for t in tokens])  # Output: [&#39;Hello&#39;, &#39; World&#39;, &#39; !&#39;]</pre><p>As you can see, our simple sentence “Hello World !” gets broken into 5 tokens:</p><ol><li>“Hello” (ID: 15496)</li><li>“ World” (ID: 2159) — notice this includes a space</li><li>“ !” (ID: 5145) — notice this includes a space</li></ol><h3>What Are Tokens?</h3><p>Tokens are the basic units that AI language models use to process text. Think of them as puzzle pieces that make up your message.</p><p>A token can be:</p><ul><li>A full word: “hello”</li><li>Part of a word: “ing”</li><li>A punctuation mark: “!”</li><li>A space: “ “</li></ul><h3>What Is a Tokenizer?</h3><p>A <strong>tokenizer</strong> is a tool that breaks text/sentences into tokens.<br>Before you can feed any sentence to an LLM (like GPT-3 or GPT-4), it must be tokenized.</p><p>Different models use different tokenizers:</p><ul><li><strong>cl100k_base</strong> → used in ChatGPT &amp; GPT-4</li><li><strong>p50k_base</strong> → used in GPT-3</li><li><strong>gpt2</strong> → used in GPT-2 and smaller models</li></ul><p>This explains why different models sometimes count tokens differently for the same input!</p><h3>Try It Yourself</h3><p>Want to see how your text gets tokenized? Try this simple app (built with <a href="https://streamlit.io/">Streamlit</a> for the UI and <a href="https://github.com/openai/tiktoken">Tiktoken</a> for actual tokenization) that lets you paste any text and see exactly how it breaks down into tokens.</p><p><a href="https://github.com/vpriyankaprabhu/simple-tokenizer">GitHub - vpriyankaprabhu/simple-tokenizer: Simple Tokenizer App - This app helps you see how language models break text into tokens. You can input any text and see exactly how it gets split into smaller pieces for processing.</a></p><h3>Why Tokenization Matters</h3><p>Understanding tokens helps you:</p><ul><li>Write efficient prompts (fewer tokens = lower cost)</li><li>Predict how LLMs might behave</li><li>Estimate token limits on inputs &amp; outputs</li><li>Build and debug your own toy LMs</li></ul><h3>Tips for Working with Tokens</h3><ol><li><strong>Be concise</strong> if you’re limited by token count</li><li><strong>Use common words</strong> when possible (they often use fewer tokens)</li><li><strong>Remember spaces count</strong> as part of tokens</li></ol><h3>Conclusion</h3><p>By understanding tokenization, you gain insight into why language models behave the way they do and how to work with them more effectively.</p><p>Next time you’re chatting with ChatGPT or any AI bot, remember it’s not reading your words the way humans do — it’s processing a series of tokens, each with its own numerical ID!.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd8db66651c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Simple To-Do List with Timer using jQuery and Python: A Hands-On Guide]]></title>
            <link>https://medium.com/@vpriyankaprabhu/building-a-simple-to-do-list-with-timer-using-jquery-and-python-a-hands-on-guide-2b2148bb9d95?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b2148bb9d95</guid>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 14:44:23 GMT</pubDate>
            <atom:updated>2025-01-12T14:44:23.042Z</atom:updated>
            <content:encoded><![CDATA[<p>When it comes to self-learning, there’s no better way than working on small, interactive projects. One such project I recently built is a <strong>To-Do List with Timer — </strong>a client server application, which combines simple front-end with <strong>jQuery </strong>and<strong> </strong>back-end file serving with <strong>Python</strong>. Using <strong>jQuery</strong> for DOM manipulation and <strong>Python</strong> for setting up a basic HTTP server, I was able to create an app that allows users to manage their tasks and time efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TdsKBcdG1AoFdWmnNDYROw.jpeg" /><figcaption>To Do List</figcaption></figure><p>In this blog post, I’ll walk you through the entire process — from creating the app’s basic functionality to setting up the Python server that serves it.</p><h3>1. Overview</h3><p>The goal of this project is to create a simple <strong>To-Do List</strong> application with an integrated <strong>Timer</strong>. Users can:</p><ul><li><strong>Add tasks</strong> to a list.</li><li><strong>Delete tasks</strong> when done.</li><li>Use the <strong>Timer</strong> feature to track time spent on tasks.</li></ul><p>Additionally, all of this is handled in a single-page application where the tasks and timer are managed in the browser, and Python is used to serve the static files.</p><h3>2. Setting Up the Development Environment</h3><ul><li><strong>Python</strong>: The Python version 3.x series is required. If you don’t have it installed, you can download it from the official <a href="https://www.python.org/downloads/">Python website</a>.</li><li><strong>Text Editor</strong>: Use any text editor you’re comfortable with (e.g., Visual Studio Code, Sublime Text, etc.).</li><li><strong>Browser</strong>: Chrome, Firefox, or any browser for testing.</li></ul><h3>3. Building the Front-End</h3><h4>HTML Structure</h4><p>Let’s start with the HTML structure of our app. The page includes:</p><ul><li>An input field to type new tasks.</li><li>Buttons for adding tasks and controlling the timer.</li><li>A display area for showing the tasks and the timer.</li></ul><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;To-Do List with Timer&lt;/title&gt;<br>    &lt;script src=&quot;https://code.jquery.com/jquery-1.12.3.min.js&quot; integrity=&quot;sha256-aaODHAgvwQW1bFOGXMeX+pC4PZIPsvn2h1sArYOhgXQ=&quot; crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;js/script.js&quot;&gt;&lt;/script&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;css/style.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;div class=&quot;container&quot;&gt;<br>        &lt;h1&gt;TO-DO List &lt;/h1&gt;<br>        <br>        &lt;div&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;task-input&quot; placeholder=&quot;Enter a new task&quot; /&gt;<br>            &lt;button id=&quot;add-task&quot;&gt;Add Task&lt;/button&gt;<br>            &lt;button id=&quot;clear-task&quot;&gt;Clear&lt;/button&gt;<br>        &lt;/div&gt;<br>        &lt;br/&gt;<br>        <br>        &lt;div id=&quot;timer-display&quot; class=&quot;hidden&quot;&gt;<br>            &lt;span id=&quot;timer&quot;&gt;00:00&lt;/span&gt;<br>            &lt;button id=&quot;start-timer&quot;&gt;Start Timer&lt;/button&gt;<br>            &lt;button id=&quot;stop-timer&quot;&gt;Stop Timer&lt;/button&gt;<br>            &lt;button id=&quot;reset-timer&quot;&gt;Reset Timer&lt;/button&gt;<br>        &lt;/div&gt;<br><br>        &lt;ul id=&quot;task-list&quot;&gt;<br>        &lt;/ul&gt;<br>    &lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h4>CSS Styling</h4><p>The design is kept simple to focus on functionality.</p><h3>4. Adding Interactivity with jQuery</h3><h4>Task Management:</h4><p>Using <strong>jQuery</strong>, we can easily handle DOM manipulations, like adding and removing tasks:</p><pre>$(function () {<br>    var timerInterval;<br>    var time = 0; // in seconds<br>    var isTimerRunning = false;<br><br>    $(&#39;#add-task&#39;).click(function() {<br>        const taskText = $(&#39;#task-input&#39;).val();<br>        if (taskText !== &quot;&quot;) {<br>            const taskItem = $(&#39;&lt;li class=&quot;task-item&quot;&gt;&lt;/li&gt;&#39;);<br>            taskItem.text(taskText+&quot;  &quot;);<br>            const deleteButton = $(&#39;&lt;button class=&quot;delete-task&quot;&gt;Delete&lt;/button&gt;&lt;br/&gt;&#39;);<br>            taskItem.append(deleteButton);<br>            $(&#39;#task-list&#39;).append(taskItem);<br><br>            // Add delete functionality<br>            deleteButton.click(function() {<br>                taskItem.remove();<br>                // Hide the timer if the task list is empty<br>                if ($(&#39;#task-list li&#39;).length === 0) {<br>                    $(&#39;#timer-display&#39;).addClass(&#39;hidden&#39;);<br>                }<br>            });<br><br>            // Show timer when the first task is added<br>            if ($(&#39;#task-list li&#39;).length === 1) {<br>                $(&#39;#timer-display&#39;).removeClass(&#39;hidden&#39;);<br>            }<br><br>            // Clear the input field<br>            $(&#39;#task-input&#39;).val(&#39;&#39;);<br>        }<br>    });<br><br>    $(&#39;#clear-task&#39;).click(function() {<br>        // Clear the input field<br>        $(&#39;#task-input&#39;).val(&#39;&#39;);<br>    });<br><br>    $(&#39;#start-timer&#39;).click(function() {<br>        if (!isTimerRunning) {<br>            isTimerRunning = true;<br>            timerInterval = setInterval(function() {<br>                time++;<br>                const minutes = Math.floor(time / 60);<br>                const seconds = time % 60;<br>                $(&#39;#timer&#39;).text(`${String(minutes).padStart(2, &#39;0&#39;)}:${String(seconds).padStart(2, &#39;0&#39;)}`);<br>            }, 1000);<br>        }<br>    });<br><br>    $(&#39;#stop-timer&#39;).click(function() {<br>        if (isTimerRunning) {<br>            clearInterval(timerInterval);<br>            isTimerRunning = false;<br>        }<br>    });<br><br>    $(&#39;#reset-timer&#39;).click(function() {<br>        clearInterval(timerInterval);<br>        isTimerRunning = false;<br>        time = 0<br>        $(&#39;#timer&#39;).text(`${String(0).padStart(2, &#39;0&#39;)}:${String(0).padStart(2, &#39;0&#39;)}`);<br>    });<br>});</pre><h3>5. Setting Up Python Backend</h3><p>The Python HTTP server is used to serve the <strong>HTML</strong>, <strong>CSS</strong>, and <strong>JavaScript</strong> files:</p><pre>import os<br>from http.server import SimpleHTTPRequestHandler<br>from socketserver import TCPServer<br><br>class MyHandler(SimpleHTTPRequestHandler):<br>    def do_GET(self):<br>        if self.path == &#39;/&#39;:<br>            self.path = &#39;/index.html&#39;<br>        elif self.path == &#39;/static/script.js&#39;:<br>            self.path = &#39;/static/script.js&#39;<br>        return super().do_GET()<br><br># Set up the server to serve the files<br>PORT = 8000<br>Handler = MyHandler<br>os.chdir(os.path.dirname(os.path.abspath(__file__)))<br><br>with TCPServer((&quot;&quot;, PORT), Handler) as httpd:<br>    print(f&quot;Serving at port {PORT}&quot;)<br>    httpd.serve_forever()</pre><h3>6. Running the Application</h3><p>To run this app locally:</p><ol><li>Make sure you have <strong>Python</strong> installed.</li><li>Run the Python HTTP server:</li></ol><pre>python app.py</pre><p>Visit http://localhost:8000 in your browser to see the app in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_Gg3vqvpaq3i8eXxqebSg.png" /><figcaption>landing page of application</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EL1LoyiqgBm66zIkMyalNg.png" /></figure><h3>7. Conclusion</h3><p>Building this to-do list with timer application helped me improve my skills in <strong>DOM manipulation</strong> with <strong>jQuery</strong> and <strong>serving static files</strong> with <strong>Python</strong>.</p><p><strong>Future Improvements:</strong></p><ul><li><strong>Persistent storage</strong> (e.g., adding a database or using localStorage for task persistence).</li><li><strong>User authentication</strong> to allow users to save their tasks across sessions.</li><li><strong>Multiple timers</strong> for different tasks, useful for time management.</li></ul><p>If you have any questions, feel free to ask in the comments!</p><p><a href="https://github.com/vpriyankaprabhu/to-do-list">GitHub - vpriyankaprabhu/to-do-list: A simple to-do list with beginners knowledge on jquery and python for understanding and implementation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b2148bb9d95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why jQuery is Still Important in 2025]]></title>
            <link>https://medium.com/@vpriyankaprabhu/why-jquery-is-still-important-in-2025-ecb9c5d043c0?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecb9c5d043c0</guid>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 14:03:19 GMT</pubDate>
            <atom:updated>2025-01-04T16:58:08.518Z</atom:updated>
            <content:encoded><![CDATA[<p>In the fast-evolving world of web development and with the rise of JavaScript frameworks like React, Angular, and Vue, you might be wondering: <strong>Is jQuery still relevant in 2025?</strong></p><p>The short answer is: <strong>Yes, jQuery is still very much relevant</strong> — and here’s why.</p><h4>What is jQuery?</h4><ul><li>jQuery is a fast, small, lightweight and feature-rich JavaScript library.</li><li>It was created to simplify the process of manipulating the DOM (Document Object Model), handling events, making animations, and working with AJAX, among other things. In short, it makes <strong>JavaScript</strong> more accessible and efficient.</li><li>It’s widely used because it works across <strong>different browsers</strong> and allows you to perform common tasks with less code compared to vanilla JavaScript.</li></ul><h4>Why learn jQuery?</h4><ul><li>jQuery is still widely used in web development, especially for smaller tasks or when working with legacy code.</li><li>jQuery allows you to easily <strong>create interactive websites</strong>, and handle common tasks like <strong>form validation</strong>, <strong>animations</strong>, and <strong>AJAX requests</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5A4bSZvpzJOWTylzM3VWg.png" /><figcaption>jQuery</figcaption></figure><h4>So Why Does jQuery Still Matter in 2025?</h4><p>Here are a few reasons why jQuery continues to be important:</p><h4>1. Simplicity and Ease of Use</h4><p>While modern JavaScript frameworks like React or Vue require a steep learning curve, jQuery’s primary advantage lies in its simplicity. Its syntax is simple and intuitive, making it ideal for beginners.</p><h4>2. Legacy Support</h4><p>When maintaining or updating old legacy codebases, apps and projects, knowing jQuery is a valuable skill. Plus, when integrating new features or fixing bugs, it’s often quicker and easier to interact with old /legacy codebases with the help of jQuery.</p><h4>3. Quick Prototypes and Small Projects</h4><p>When you’re working on a personal project or prototype, jQuery allows you to focus on building your idea without worrying about complex setups or configurations.</p><h4>4. Cross-Browser Compatibility</h4><p>One of the reasons jQuery became so popular in the past was its ability to smooth out the differences between browsers and also ensure compatibility across older versions of browsers.</p><h4>5. Integration with Modern Frameworks</h4><p>Even in modern applications such as React, you might integrate jQuery to handle animations or form validation or DOM manipulation in conjunction with a more complex applications.</p><h4>Conclusion: jQuery Is Here to Stay and still a Powerful tool</h4><p>While new technologies emerge, <strong>jQuery</strong> continues to be a versatile tool for quick development, legacy support, and simple interactivity. It remains widely used in small-to-medium projects, especially when time and simplicity matter most.</p><p>If you’re a developer looking for a fast, efficient way to handle dynamic web features or maintain existing projects, <strong>jQuery</strong> should still be part of your toolbox.</p><p><strong>Check out beginner-friendly jQuery examples👇</strong></p><p><a href="https://github.com/vpriyankaprabhu/Jquery-examples">GitHub - vpriyankaprabhu/Jquery-examples: Jquery practice learning examples</a></p><h4>#jQuery #Learning #Consistency #JavaScript #FrontendDevelopment #Prototyping</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecb9c5d043c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating the Tracking of Medium Posts with Python: Save Time & Stay Informed! ]]></title>
            <link>https://medium.com/@vpriyankaprabhu/automating-the-tracking-of-medium-posts-with-python-save-time-stay-informed-a0624f5d2692?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0624f5d2692</guid>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Mon, 23 Dec 2024 10:18:46 GMT</pubDate>
            <atom:updated>2025-01-04T16:57:47.297Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s fast-paced world, <strong>staying updated on the latest trends</strong> and insights is crucial — especially when it comes to tracking content from industry leaders, competitors, or influencers. If you follow <strong>Medium profiles</strong> to keep up with relevant articles based on latest technologies and applications manually, checking such profiles for new content can be time-consuming and inefficient.</p><p>Thankfully, there’s a simple solution to automate this task using <strong>Python</strong> and <strong>RSS feeds</strong> from Medium. In this post, I’ll show you how to <strong>automatically track posts</strong> from a specific Medium profile and save the details for further analysis or reporting.</p><h3>Problem Statement: Manual tracking/monitoring medium profiles</h3><p>Staying updated on the latest articles from key industry influencers, subject matter experts is important for many professionals. However, manually checking multiple Medium profiles can be time-consuming, especially when tracking many different sources.</p><p><strong>Problem:</strong></p><ul><li>Checking new posts from Medium profiles manually takes time.</li><li>Keeping track of content from competitors, industry subject matter experts, or thought leaders can be cumbersome.</li><li>Automating this process will save time and make content tracking more efficient.</li></ul><h3>Solution: Automating Medium Profile Posts Tracking with RSS feeds and Python</h3><p>We can <strong>automate the process of fetching new posts</strong> from a Medium profile by using <strong>Python</strong> and <strong>RSS feeds</strong>. Medium provides an RSS feed for each user, which can be parsed with Python to automatically extract key details like <strong>article titles</strong>, <strong>publication dates</strong>, and <strong>URLs</strong>.</p><p><strong>Solution:</strong></p><ul><li>Use Python to automatically check the <strong>RSS feed</strong> of a Medium profile.</li><li>Extract useful article details like <strong>title</strong>, <strong>link</strong>, and <strong>publish date</strong>.</li><li>Save the information in a file for easy access, making it faster to analyze or report.</li></ul><figure><img alt="Medium Profile RSS feed parsing using Python" src="https://cdn-images-1.medium.com/max/1024/1*F9r1Xs901CD_MunW8UwOKw.jpeg" /></figure><h4>What You’ll Need:</h4><ul><li><strong>Python</strong> installed on your computer.</li><li>The <strong>feedparser library</strong> to parse RSS feeds (which can be installed via pip).</li></ul><h3>How It Works: Step-by-Step</h3><p><strong>Step 1 : Install Python’s </strong><strong>feedparser Library</strong><br>First, you’ll need to install the <strong>feedparser</strong> library, which helps in parsing RSS feeds. You can install it with pip:</p><pre>pip install feedparser</pre><p><strong>Step 2: Python Script to Fetch and Parse Medium RSS Feed<br></strong>Here’s a simple Python script that does the work for you. It fetches the RSS feed from a Medium profile, extracts article details (like title, link, and publish date), and saves the data into a text file.</p><pre>import feedparser<br><br># Method to construct and parse rss url to fetch the user&#39;s feed details<br>def construct_and_parse_rss_url(https://medium.com/username):<br>    # Construct the RSS feed URL for the given username<br>    rss_url = f&#39;https://medium.com/feed/@{username}&#39;<br>    <br>    # Parse the RSS feed url<br>    feed = feedparser.parse(rss_url)<br>    <br>    # Check if there are entries in the feed<br>    if not feed.entries:<br>        print(f&quot;\nNo medium.com articles found for given user {username}.\n&quot;)<br>        return None<br>    else:<br>        return feed<br><br># Method to save fetched medium user&#39;s feed details/entries in txt file format<br>def save_medium_rss_feed_details_in_txt_format(feed, username):<br>    # Save article details into a text file<br>    with open(f&#39;{username}_medium_feed.txt&#39;, &#39;w&#39;, encoding=&#39;utf-8&#39;) as file:<br>        file.write(&quot;-&quot;*90 + &quot;\n\n&quot;)<br>        file.write(f&quot;{feed.feed.title}\n\n&quot;)<br>        file.write(f&quot;Author : {username}\n&quot;)<br>        file.write(f&quot;Profile URL : {feed.feed.link}\n&quot;)<br>        file.write(&quot;\n&quot; + &quot;-&quot;*90 + &quot;\n\n&quot;)<br>        for entry in feed.entries:<br>          # Write the article information to the file<br>            file.write(f&quot;Title : {entry.title}\n&quot;)<br>            file.write(f&quot;Link : {entry.link}\n&quot;)<br>            file.write(f&quot;Published: {entry.published}\n&quot;)<br>            file.write(&quot;\n&quot; + &quot;-&quot;*90 + &quot;\n\n&quot;)<br>    <br>    print(f&quot;\nFeed data from medium.com for {username} has been saved to {username}_medium_feed.txt file for analysis or reporting.\n&quot;)<br><br># Example usage: Fetch data for a specific Medium profile<br>username = input(&quot;Enter the Medium username: &quot;)<br>feed = construct_and_parse_rss_url(https://medium.com/username)<br>save_medium_rss_feed_details_in_txt_format(feed, username)</pre><p><strong>Step 3: What Happens in the Script?</strong></p><ol><li>The script takes a <strong>Medium username</strong> (like @username).</li><li>It automatically fetches the RSS feed of that profile.</li><li>The script extracts the <strong>title</strong>, <strong>link</strong>, and <strong>published date</strong> of each article.</li><li>It saves this data to a .txt and .json files, which can later be opened and reviewed.</li></ol><p><strong>Example Output:</strong></p><pre>Enter the Medium username:  vpriyankaprabhu<br><br>Feed data from medium.com for vpriyankaprabhu has been saved to vpriyankaprabhu_medium_feed.txt file for analysis or reporting.<br><br>Feed data from medium.com for vpriyankaprabhu has been saved to vpriyankaprabhu_medium_feed.json file for analysis or reporting.<br><br>Do you want to continue (Y/N) :  N</pre><pre>### vpriyankaprabhu_medium_feed.txt<br><br>------------------------------------------------------------------------------------------<br><br>Stories by priyanka prabhu on Medium<br><br>Author : vpriyankaprabhu<br>Profile URL : https://medium.com/@vpriyankaprabhu?source=rss-1c36e7bb3532------2<br><br>------------------------------------------------------------------------------------------<br><br>Title : The Magic of Packing &amp; Unpacking in Python  : Simplifying Your Code<br>Link : https://medium.com/@vpriyankaprabhu/the-magic-of-packing-unpacking-in-python-simplifying-your-code-04db783341fe?source=rss-1c36e7bb3532------2<br>Published: Wed, 27 Nov 2024 10:59:46 GMT<br><br>------------------------------------------------------------------------------------------<br><br>Title : Effortless Bookmark Organization with Python and Custom Rules<br>Link : https://medium.com/@vpriyankaprabhu/effortless-bookmark-organization-with-python-and-custom-rules-bfec4475d176?source=rss-1c36e7bb3532------2<br>Published: Sat, 16 Nov 2024 12:17:48 GMT<br><br>------------------------------------------------------------------------------------------</pre><pre>### vpriyankaprabhu_medium_feed.json<br><br>{<br>  &quot;Blog title&quot;: &quot;Stories by priyanka prabhu on Medium&quot;,<br>  &quot;Blog link&quot;: &quot;https://medium.com/@vpriyankaprabhu?source=rss-1c36e7bb3532------2&quot;,<br>  &quot;posts&quot;: [<br>    {<br>      &quot;title&quot;: &quot;The Magic of Packing &amp; Unpacking in Python \u00a0: Simplifying Your Code&quot;,<br>      &quot;link&quot;: &quot;https://medium.com/@vpriyankaprabhu/the-magic-of-packing-unpacking-in-python-simplifying-your-code-04db783341fe?source=rss-1c36e7bb3532------2&quot;,<br>      &quot;author&quot;: &quot;priyanka prabhu&quot;,<br>      &quot;time_published&quot;: &quot;Wed, 27 Nov 2024 10:59:46 GMT&quot;<br>    },<br>    {<br>      &quot;title&quot;: &quot;Effortless Bookmark Organization with Python and Custom Rules&quot;,<br>      &quot;link&quot;: &quot;https://medium.com/@vpriyankaprabhu/effortless-bookmark-organization-with-python-and-custom-rules-bfec4475d176?source=rss-1c36e7bb3532------2&quot;,<br>      &quot;author&quot;: &quot;priyanka prabhu&quot;,<br>      &quot;time_published&quot;: &quot;Sat, 16 Nov 2024 12:17:48 GMT&quot;<br>    }<br>  ]<br>}</pre><h3>Benefits of Automating Medium Content Tracking</h3><ul><li><strong>Stay Informed &amp; Save Time:</strong> Keep track of new posts and automatically fetch and store data from various Medium profiles without having to visit each profile manually.</li><li><strong>Efficient Data Collection:</strong> Use the collected data for further analysis, or reporting.</li></ul><p>By automating this task, you can streamline your workflow and focus on what matters most — <strong>analysing the content</strong>, not gathering it.</p><h3>Use Cases</h3><ul><li><strong>Competitive Analysis</strong>: Monitor new posts from subject matter experts or industry leaders to stay updated on their activities.</li><li><strong>Market Research</strong>: Track articles from specific authors or publications to analyse latest trends in industry.</li><li><strong>Data Collection</strong>: Collect and archive articles for future analysis &amp; reporting.</li></ul><h3>Conclusion</h3><p>By using this simple Python script, we can <strong>automate the process of tracking Medium posts</strong> from key sources. This saves time, improves efficiency, and ensures that we stay updated with the latest content without manual effort.</p><p>Check out the complete Python script and start automating your content tracking today!</p><p><a href="https://github.com/vpriyankaprabhu/medium-profile-rss-feed-parsing">GitHub - vpriyankaprabhu/medium-profile-rss-feed-parsing: Simple Python project to parse Medium.com profile RSS feed parsing and saving its data in .txt and .json format for further analysis or reporting tasks.</a></p><p><strong>#Python #Automation #DataCollection #MarketResearch #RSSFeeds #LearningJourney #Consistency</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0624f5d2692" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Magic of Packing & Unpacking in Python  : Simplifying Your Code]]></title>
            <link>https://medium.com/@vpriyankaprabhu/the-magic-of-packing-unpacking-in-python-simplifying-your-code-04db783341fe?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/04db783341fe</guid>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Wed, 27 Nov 2024 10:59:46 GMT</pubDate>
            <atom:updated>2025-01-04T16:58:47.185Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>The Magic of Packing &amp; Unpacking in Python</strong> 🐍 : Simplifying Your Code</h3><p>Python is known for its simplicity and readability, and two features that enhance this are “<strong>packing</strong>” and “<strong>unpacking</strong>”. The terms <strong>packing</strong> and <strong>unpacking</strong> in Python refer to the way where arguments or multiple items are grouped into a single entity or to break down the grouped items into individual items in an efficient way.</p><p>Understanding packing and unpacking is very essential and this blog post will guide you through these concepts, show how to use them, and explain its importance in real-world Python programming.</p><figure><img alt="Packing and Unpacking in Python" src="https://cdn-images-1.medium.com/max/1024/1*47tytrs6AZtTEoiw0ySAeg.png" /></figure><p>In Python, there are <strong>tuples</strong>, <strong>lists</strong>, and <strong>dictionaries</strong> — these are more like the containers that hold many different types of things. But while they were incredibly useful, there is one small problem: its not always easy to pass the contents of these containers into a function, or vice versa.</p><p>Let me tell you a little <strong>“story”</strong> to illustrate the power of <strong>packing</strong> and <strong>unpacking</strong>!</p><blockquote>One day, a group of adventurers/explorers wanted to set out on a journey. They had many things to carry: maps, clothes, swords, food supplies, and water bottles. But they needed a better way to organise and pack their items.</blockquote><pre>def pack_items_for_journey(*items):<br>  # *items collects all passed arguments into a tuple<br>  return items<br><br>packed_items = pack_items_for_journey(&quot;map&quot;, &quot;clothes&quot;, &quot;sword&quot;, &quot;food&quot;, &quot;water&quot;)<br><br>print(packed_items) # Output: (&#39;map&#39;, &#39;clothes&#39;, &#39;sword&#39;, &#39;food&#39;, &#39;water&#39;)</pre><blockquote>The <strong>*</strong>items in the function’s argument list is a <strong>packing operator</strong>. It allows to gather all the arguments into one container — a tuple(by default).</blockquote><p>In Python, <strong>Packing</strong> means taking or collecting or grouping multiple elements and putting them into a single container, like a tuple or list, which can then be passed as arguments to functions or returned from functions.</p><h4><strong>How Packing Works ?</strong></h4><p>In Python, packing happens when you pass multiple values to a function using an asterisk (‘<strong>*</strong>’) for lists/tuples or double asterisks (‘<strong>**</strong>’) for dictionaries.</p><h4>Examples of Packing:</h4><ol><li>Packing with Tuples -</li></ol><pre># Packing multiple values into a tuple<br>def print_values(*args):<br>  print(args)<br><br>print_values(1, 5, 3) # Output: (1, 5, 3)</pre><p>Here, the ‘*args’ syntax <strong>packs</strong> all the values passed to the function into a single tuple (‘args’ — by default).</p><p>2. Packing with Lists -</p><pre>def store_data(*values):<br>  return list(values)<br><br>result = store_data(10, 20, 30, 40)<br><br>print(result) # Output: [10, 20, 30, 40]</pre><p>3. Packing with Dictionaries -</p><p>In the case of dictionaries, you can use the <strong>‘**’</strong> syntax to pass multiple keyword arguments.</p><pre>def store_customer_details(**kwargs):<br>  print(kwargs)<br><br>store_customer_details(name=&quot;XYZ&quot;, age=30, city=&quot;New York&quot;)<br><br># Output: {&#39;name&#39;: &#39;XYZ&#39;, &#39;age&#39;: 30, &#39;city&#39;: &#39;New York&#39;}</pre><p>Here, ‘**kwargs’ <strong>packs</strong> the key-value pairs into a dictionary.</p><blockquote>As the adventurers/explorers went along their journey, they realised they didn’t always need to carry everything in a big container. Sometimes they needed only a few specific items from their packed collection.</blockquote><blockquote>This can be related to <strong>unpacking </strong>in Python — the magical ability to open a container and extract individual items.</blockquote><pre>def unpack_items(*items):<br>  map_item, clothes_item, sword_item, food_item, water_item = items<br>  print(f&quot;Map: {map_item}, Clothes: {clothes_item}, Sword: {sword_item}, Food: {food_item}, Water: {water_item}&quot;)<br><br>unpack_items(&quot;map&quot;, &quot;clothes&quot;, &quot;sword&quot;, &quot;food&quot;, &quot;water&quot;)</pre><blockquote>The asterisk (*) was key again, but this time it was used to break the tuple back down into separate items and assign them to variables.</blockquote><p><strong>Unpacking </strong>in Python is the opposite of packing. It allows you to break a collection of values (like a tuple, list, or dictionary) into series of individual variables or components. It’s particularly useful when you have a collection of values that you want to assign to separate variables for ease of use.</p><p>Python supports multiple ways of unpacking, including unpacking iterables (like lists or tuples) and dictionaries.</p><h4>How Unpacking Works ?</h4><p>To unpack a collection, you can use the <strong>‘*’ </strong>operator (for lists or tuples) or <strong>‘**’</strong> (for dictionaries).</p><h4>Examples of Unpacking:</h4><pre>coordinates = (10, 20)<br><br># Unpacking a tuple<br>x, y = coordinates<br><br>print(x, y) # Output: 10 20</pre><p>In this example, the values from the tuple ‘coordinates’ are unpacked into the variables ‘x’ and ‘y’.</p><ol><li>Unpacking with Lists -</li></ol><pre>data = [1, 2, 3]<br><br># Unpacking a list into series of variables<br>a, b, c = data<br><br>print(a, b, c) # Output: 1 2 3</pre><p>2. Unpacking with Iterables -</p><p>Python allows to unpack iterables with more flexibility by using the <strong>‘*’</strong> operator.</p><pre># Unpacking with * for the remaining values<br>first, *rest = [1, 2, 3, 4, 5]<br><br>print(first) # Output: 1<br><br>print(rest) # Output: [2, 3, 4, 5]</pre><p>In the above example, ‘first’ gets the first item from the list, and ‘rest’ contains the remaining items from the list.</p><p>3. Unpacking with Dictionaries -</p><pre>employee_info = {&#39;Name&#39;: &#39;Alice&#39;, &#39;Age&#39;: 30, &#39;City&#39;: &#39;New York&#39;}<br><br># Unpacking a dictionary using **kwargs<br>def print_info(**info):<br>  for key, value in info.items():<br>    print(f&quot;{key}: {value}&quot;)<br><br>print_info(**employee_info) # Output: Name: Alice, Age: 30, City: New York</pre><p>The ‘**employee_info’ syntax packed the key-value pairs of a dictionary into the function, and the ‘**info’ unpacks the dictionary and passes the key-value pairs as keyword arguments.</p><h4>Real-World Use Cases of Packing and Unpacking</h4><p>Let’s explore some real-world use cases where these techniques can make your code more readable, flexible, efficient, and concise.</p><p>1. Handling Function Arguments Dynamically</p><p>When you don’t know in advance how many arguments a function will receive, packing allows you to accept a variable number of arguments. This is especially useful in functions like logging, event handling etc.</p><pre>def log_message(*messages):<br>  for message in messages:<br>    print(message)<br><br>log_message(&quot;Error: File not found&quot;, &quot;Warning: Low disk space&quot;, &quot;Info: Process completed&quot;)</pre><p>2. Swapping Values</p><p>Python makes swapping values simple with unpacking. You don’t need a temporary variable; you can directly swap values using a tuple unpacking syntax.</p><pre>a = 5<br>b = 10<br><br>a, b = b, a # Swap values<br><br>print(a, b) # Output: 10 5</pre><p>3. Iterating Over Complex Data Structures</p><p>When working with complex data structures like lists of tuples, you can use unpacking to easily extract values in a for-loop.</p><pre>coordinates = [(1, 2), (3, 4), (5, 6)]<br><br>for x, y in coordinates:<br>  print(f&quot;x: {x}, y: {y}&quot;)</pre><p>4. Unpacking in Function Return Values</p><p>When you have a function that returns multiple values, unpacking allows you to capture these values in separate variables.</p><pre>def get_person():<br>  return &quot;Alice&quot;, 30, &quot;New York&quot;<br><br>name, age, city = get_person()<br><br>print(f&quot;Name: {name}, Age: {age}, City: {city}&quot;)</pre><p>5. Merging Dictionaries</p><p>Python’s ‘**’ double star operator can be used to merge dictionaries, which can be particularly helpful in situations like merging JSON objects.</p><pre>dict1 = {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 30}<br>dict2 = {&#39;city&#39;: &#39;New York&#39;, &#39;country&#39;: &#39;USA&#39;}<br><br>merged_dict = {**dict1, **dict2}<br><br>print(merged_dict) # Output: {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 30, &#39;city&#39;: &#39;New York&#39;, &#39;country&#39;: &#39;USA&#39;}</pre><p><strong>‘**’ </strong>This operator unpacks the key-value pairs from the second dictionary dict2 and integrates them into the first one dict1. If there are any duplicate keys, the values from the second dictionary will take precedence.</p><h4>The Power of Packing and Unpacking in Python</h4><p><strong>Packing</strong> and <strong>Unpacking</strong> in Python are powerful techniques that help you manage data and arguments in a more flexible, clean, and efficient manner. By utilizing the <strong>‘*’ single star operator </strong>and <strong>‘**’</strong> <strong>double star operator</strong>, you can:</p><p><strong>→</strong> Simplify your code when dealing with variable-length argument lists.</p><p><strong>→</strong> Work with complex data structures like lists, nested lists/tuples and dictionaries more intuitively.</p><p><strong>→</strong> Create cleaner, more readable, and maintainable code.</p><p>And so, with packing and unpacking, Python became a more powerful and flexible tool for the adventurers/explorers of the programming world.</p><blockquote>#Python #Programming #Tech #Consistency #CleanCode #TechTips #CodingTips #PythonTips</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04db783341fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Effortless Bookmark Organization with Python and Custom Rules]]></title>
            <link>https://medium.com/@vpriyankaprabhu/effortless-bookmark-organization-with-python-and-custom-rules-bfec4475d176?source=rss-1c36e7bb3532------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfec4475d176</guid>
            <dc:creator><![CDATA[priyanka prabhu]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 12:17:48 GMT</pubDate>
            <atom:updated>2024-11-16T16:49:09.563Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s digital world, we all know how quickly bookmarks can pile up — from technical tutorials to interesting articles and useful websites. Without an effective way to organize them, they can easily become overwhelming. So, I decided to give it a try and solve this problem by using Python with the help of a config file that defines the sorting or categorization rules for bookmarks.</p><figure><img alt="Effortless Bookmark Categorization with Custom Rules" src="https://cdn-images-1.medium.com/max/1024/1*xukxqaTPC52mINswiV7hgw.png" /><figcaption>Effortless Bookmark Categorization with Custom Rules</figcaption></figure><p>In this post, I’ll walk you through how I organized my bookmarks with <strong>Python</strong> by parsing a bookmark file and categorizing the entries based on predefined rules in the <strong>config file</strong>, I was able to create more organized, structured and readable version of my bookmarks. Let’s dive in!</p><h4><strong>What we’re going to do:</strong></h4><p><strong>1. Parse a browser Bookmark file: </strong><br>We’ll read/load a JSON file that contains the browser bookmarks.</p><p><strong>2. Use a config file with custom rules defined for categorization: </strong><br>Define custom rules in a separate config file to determine how bookmarks should be categorized/sorted.</p><p><strong>3. Generate a new user readable file with Bookmarks in organized manner:</strong><br>Create a new output file where bookmarks are categorized in a more organized, structured user readable format.</p><h4><strong>Step-by-Step Guide:</strong></h4><ol><li><strong>Create a config file with custom rules for categorization:<br></strong>The config.json file will define custom rules for categorizing bookmarks based on certain category and keywords or tags. Let’s assume we are categorizing bookmarks by category like “Technology,” “Science,” “Finance”, “Entertainment” and “Travel &amp; Lifestyle.”</li></ol><pre>/** <br>* Example config.json file with custom rules for categorization <br>*/<br><br>{<br>    &quot;categories&quot;: {<br>        &quot;Technology&quot;: [<br>            &quot;Python&quot;,<br>            &quot;Programming&quot;,<br>            &quot;Kubernetes&quot;,<br>            &quot;K8S&quot;,<br>            &quot;AI&quot;,<br>            &quot;Software&quot;,<br>            &quot;Containerization&quot;<br>        ],<br>        &quot;Science&quot;: [<br>            &quot;Physics&quot;,<br>            &quot;Biology&quot;,<br>            &quot;Chemistry&quot;,<br>            &quot;Space&quot;<br>        ],<br>        &quot;Travel &amp; Lifestyle&quot;: [<br>            &quot;Travel&quot;,<br>            &quot;Flights&quot;,<br>            &quot;Health&quot;,<br>            &quot;Fitness&quot;<br>        ],<br>        &quot;Entertainment&quot;: [<br>            &quot;News&quot;,<br>            &quot;Music&quot;,<br>            &quot;Movies&quot;,<br>            &quot;Podcasts&quot;<br>        ],<br>        &quot;Finance&quot;: [<br>            &quot;Investment&quot;,<br>            &quot;Mutual Funds&quot;<br>        ]<br>    }<br>}</pre><p><strong>2. Create a browser Bookmark file :<br></strong>We’ll use a Bookmark JSON file containing our bookmarks. For demonstration purpose, we will consider only a small section of browser bookmarks. These bookmarks will further be filtered to pick the required values such as name, URL, and tags.</p><pre>/** <br>* Example firefox_bookmarks.json file for filtering required values such as name, URL, and tags. <br>*/<br><br><br>{<br>  &quot;guid&quot;: &quot;root________&quot;,<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;index&quot;: 0,<br>  &quot;dateAdded&quot;: 1659529435080000,<br>  &quot;lastModified&quot;: 1731732376511000,<br>  &quot;id&quot;: 1,<br>  &quot;typeCode&quot;: 2,<br>  &quot;type&quot;: &quot;text/x-moz-place-container&quot;,<br>  &quot;root&quot;: &quot;placesRoot&quot;,<br>  &quot;children&quot;: [<br>    {<br>      &quot;guid&quot;: &quot;7BdzFl46YrJr&quot;,<br>      &quot;title&quot;: &quot;sample-testing&quot;,<br>      &quot;index&quot;: 601,<br>      &quot;dateAdded&quot;: 1731732089305000,<br>      &quot;lastModified&quot;: 1731732376511000,<br>      &quot;id&quot;: 2881,<br>      &quot;typeCode&quot;: 2,<br>      &quot;type&quot;: &quot;text/x-moz-place-container&quot;,<br>      &quot;children&quot;: [<br>        {<br>          &quot;guid&quot;: &quot;gVk87YVmo6y9&quot;,<br>          &quot;title&quot;: &quot;Python 3.13.0 Documentation&quot;,<br>          &quot;index&quot;: 0,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2883,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Programming,Python&quot;,<br>          &quot;iconUri&quot;: &quot;https://docs.python.org/3/_static/py.svg&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://docs.python.org/3/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;BBI46PiQxFvQ&quot;,<br>          &quot;title&quot;: &quot;Kubernetes Documentation | Kubernetes&quot;,<br>          &quot;index&quot;: 1,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2884,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Containerization,K8S,Kubernetes&quot;,<br>          &quot;iconUri&quot;: &quot;https://kubernetes.io/icons/icon-128x128.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://kubernetes.io/docs/home/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;6T5PfcKq8uRj&quot;,<br>          &quot;title&quot;: &quot;MakeMyTrip - #1 Travel Website 50% OFF on Hotels, Flights &amp; Holiday&quot;,<br>          &quot;index&quot;: 2,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2885,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Travel&quot;,<br>          &quot;iconUri&quot;: &quot;https://imgak.mmtcdn.com/pwa/assets/img/mmt_launcher_192x192.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.makemytrip.com/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;Gr8MoB9A1Hug&quot;,<br>          &quot;title&quot;: &quot;Book Flights, Hotels, Holidays, Bus &amp; Train Tickets - EaseMyTrip.com&quot;,<br>          &quot;index&quot;: 3,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2886,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Flights,Travel&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.easemytrip.com/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;wISaNyf_AxbA&quot;,<br>          &quot;title&quot;: &quot;Tripadvisor: Over a billion reviews &amp; contributions for Hotels, Attractions, Restaurants, and more&quot;,<br>          &quot;index&quot;: 4,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2887,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Travel&quot;,<br>          &quot;iconUri&quot;: &quot;https://static.tacdn.com/favicon.ico?v2&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.tripadvisor.in/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;_nDM7GvoBouM&quot;,<br>          &quot;title&quot;: &quot;NASA&quot;,<br>          &quot;index&quot;: 5,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2888,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Physics,Science,Space&quot;,<br>          &quot;iconUri&quot;: &quot;https://www.nasa.gov/wp-content/plugins/nasa-hds-core-setup/assets/favicons/favicon-228x228.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.nasa.gov/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;G_vBul6OOsK4&quot;,<br>          &quot;title&quot;: &quot;NASA Science&quot;,<br>          &quot;index&quot;: 6,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2889,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Physics,Science&quot;,<br>          &quot;iconUri&quot;: &quot;https://science.nasa.gov/apple-touch-icon.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://science.nasa.gov/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;8XHlXz3_cCwC&quot;,<br>          &quot;title&quot;: &quot;Indian Space Research Organisation&quot;,<br>          &quot;index&quot;: 7,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2890,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Science,Space&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.isro.gov.in/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;V8p911g-Ec9u&quot;,<br>          &quot;title&quot;: &quot;News - Latest News, Breaking News, Bollywood, Sports, Business and Political News | Times of India&quot;,<br>          &quot;index&quot;: 8,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2891,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Entertainment,News&quot;,<br>          &quot;iconUri&quot;: &quot;https://m.timesofindia.com/touch-icon-ipad-retina-precomposed.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://timesofindia.indiatimes.com/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;tJenjRLHPvCK&quot;,<br>          &quot;title&quot;: &quot;Breaking News Today, Top Headlines, Live Updates | The Hindu&quot;,<br>          &quot;index&quot;: 9,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2892,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Entertainment,News&quot;,<br>          &quot;iconUri&quot;: &quot;https://www.thehindu.com/apple-touch-icon.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.thehindu.com/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;kPYWjBfUtBh1&quot;,<br>          &quot;title&quot;: &quot;Zerodha: Online brokerage platform for stock trading &amp; investing&quot;,<br>          &quot;index&quot;: 10,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2893,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Finance,Investment&quot;,<br>          &quot;iconUri&quot;: &quot;https://zerodha.com/static/images/favicon.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://zerodha.com/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;swrRJQ9l81JR&quot;,<br>          &quot;title&quot;: &quot;Kuvera - Invest in Mutual Funds, Fixed Deposits , Stocks and more&quot;,<br>          &quot;index&quot;: 11,<br>          &quot;dateAdded&quot;: 1731732103539000,<br>          &quot;lastModified&quot;: 1731732103539000,<br>          &quot;id&quot;: 2894,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Investment,MutualFunds&quot;,<br>          &quot;iconUri&quot;: &quot;https://assets2.kuvera.in/production/babylon/1.0.35/assets/img/favicons/android-icon-192x192.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://kuvera.in/&quot;<br>        },<br>        {<br>          &quot;guid&quot;: &quot;BZQZNLddyqKc&quot;,<br>          &quot;title&quot;: &quot;WebMD - Better information. Better health.&quot;,<br>          &quot;index&quot;: 12,<br>          &quot;dateAdded&quot;: 1731732339345000,<br>          &quot;lastModified&quot;: 1731732376511000,<br>          &quot;id&quot;: 2934,<br>          &quot;typeCode&quot;: 1,<br>          &quot;tags&quot;: &quot;Health,Lifestyle&quot;,<br>          &quot;iconUri&quot;: &quot;https://img.lb.wbmdstatic.com/vim/live/webmd/consumer_assets/site_images/favicon/favicon_144.png&quot;,<br>          &quot;type&quot;: &quot;text/x-moz-place&quot;,<br>          &quot;uri&quot;: &quot;https://www.webmd.com/&quot;<br>        }<br>      ]<br>    }<br>  ]<br>}</pre><p>Let’s understand how we will go about filtering the bookmarks file to pick required values such as name, URL, and tags.</p><pre># We will now try to parse firefox_bookmarks.json file to get minimal required values such as name, title, tags for<br># further parsing and categorizing them with the config.json categorization rules<br><br>import json<br><br># Load firefox_bookmarks.json file for parsing<br>with open(&quot;firefox_bookmarks.json&quot;, &quot;r&quot;) as f:<br>    bookmarks_content = json.load(f)<br><br># Temporary variable to save the bookmarks as list with minimal required values such as <br># name, url, tags by parsing bookmarks_content<br>bookmarks_list = []<br><br># Save minimal required values such as name, url, tags by parsing bookmarks_content into bookmarks_list<br>for root_bookmark_children_section in bookmarks_content[&quot;children&quot;]:<br>    <br>    # firefox bookmarks picked from sample-testing folder for this example<br>    # We will check for this child nodes and start parsing<br>    if root_bookmark_children_section[&quot;title&quot;] == &quot;sample-testing&quot;:<br>        <br>        # For each child bookmark lets create a dictionary and save it in bookmarks_list<br>        for child_bookmark in root_bookmark_children_section[&quot;children&quot;]:<br>            <br>            # Split the tags with , as delimited and save it as list<br>            tags = child_bookmark[&quot;tags&quot;].split(&quot;,&quot;)<br>            <br>            # Dictionary with required values as name, url, tags<br>            local_dict = {&quot;name&quot; : child_bookmark[&quot;title&quot;], &quot;url&quot; : child_bookmark[&quot;uri&quot;], &quot;tags&quot; : tags}<br>            <br>            # bookmarks_list is appended with dictionary created from values for name, title and tags<br>            bookmarks_list.append(local_dict)<br><br># We will save bookmarks_list with file name : bookmark_data.json<br>bookmarks_data_file_name = &quot;bookmark_data.json&quot;<br><br># Write bookmarks_list to bookmark_data.json file<br>with open(bookmarks_data_file_name, &quot;w&quot;) as bookmarks_file_handler:<br>    # Need to replace single quote with double quotes for json file parsing else throws error<br>    bookmarks_file_handler.write(str(bookmarks_list).replace(&quot;&#39;&quot;, &quot;\&quot;&quot;))</pre><p><strong>3. Parsing and Categorizing with Python :<br></strong> Now let’s write a Python script to read both the bookmarks and config file, categorize the bookmarks, and then output the organized bookmarks into a readable format.</p><pre>import json<br><br># Since now, we have both config.json and bookmark_data.json(filtered) files ready, <br># lets try to work on them. We will have to now use the custom rules or configs <br># mentioned in config.json for effortless categorization of browser bookmarks saved <br># in firefox_bookmarks.json file. <br># The output should be user friendly and readable format for ready reference.<br><br># Load the config.json file<br>with open(&quot;config.json&quot;) as f:<br>   config = json.load(f)<br><br># Load the bookmark_data.json file<br>with open(&quot;bookmark_data.json&quot;) as f:<br>   bookmarks = json.load(f)<br><br># Logic to categorize bookmarks using config.json custom rules for <br># categorization on bookmark_data.json data<br>def categorize_bookmarks(bookmarks, config):<br>   # Create a new empty list &quot;categorized&quot; with categories <br>   # for example : [&#39;Technology&#39;: [], &#39;Science&#39;: [], &#39;Education&#39;: [], &#39;Entertainment&#39; : [], &#39;Finance&#39; : []]<br>   categorized = {category: [] for category in config[&#39;categories&#39;]}<br>   <br>   # Go through each bookmarks (list of dictionaries)<br>   for bookmark in bookmarks:<br>       <br>      # Check each tag in the bookmark<br>       for tag in bookmark[&#39;tags&#39;]:<br>           <br>          # We now need to check each bookmark tag with tag keywords list <br>          # in config[categories] for each category<br>           for category, keywords in config[&#39;categories&#39;].items():<br>               <br>                if tag.lower() in [keyword.lower() for keyword in keywords]:<br>                   <br>                   # if bookmark tag is found in tag keywords of each category <br>                   # then append local_dict to categorized[categorized] list<br>                   local_dict = {&quot;name&quot;: bookmark[&#39;name&#39;], &quot;url&quot;: bookmark[&#39;url&#39;]}<br>                   <br>                   if local_dict in categorized[category]:<br>                       # to skip adding duplicate entries to categorized[category] list<br>                       break<br>                   else:<br>                       # append local_dict to categorized[categorized] list<br>                       categorized[category].append(local_dict)<br>                       <br>   # returns categorized list<br>   return categorized<br><br># Categorize the bookmarks<br>categorized_bookmarks = categorize_bookmarks(bookmarks, config)</pre><p><strong>4. Generate Output File (organized_bookmarks.md) :<br></strong>Finally, the result/output will be an organized markdown file, categorized neatly for easy reading and reference.</p><pre># Lets finally create a user readable markdown file<br># with categorized/organise bookmarks for ready reference.<br><br># Create a readable output format<br>output = &quot;&quot;<br>for category, items in categorized_bookmarks.items():<br>   output += f&quot;##### {category} \n&quot;<br>   for item in items:<br>       output += f&quot;- [{item[&#39;name&#39;]}]({item[&#39;url&#39;]})\n&quot;<br>   output += &quot;\n&quot;<br><br># Write the categorized bookmarks to an output file organized_bookmarks.md<br>with open(&#39;organized_bookmarks.md&#39;, &#39;w&#39;) as f:<br>   f.write(output)<br><br><br># We will save user friendly output with file name : organized_bookmarks.md<br>organized_bookmarks_file_name = &quot;organized_bookmarks.md&quot;<br><br># Write output to organized_bookmarks.md file for organised/categorized bookmarks<br>with open(organized_bookmarks_file_name, &quot;w&quot;) as output_file_handler:<br>    output_file_handler.write(output)<br>    <br># Reading organized_bookmarks.md file to check its contents<br>with open(organized_bookmarks_file_name, &quot;r&quot;) as output_file_handler:<br>    organized_bookmark_contents = output_file_handler.read()<br>    # move the file pointer to beginning of the file for next read<br>    output_file_handler.seek(0)<br><br># Print contents of config.json file<br>print(organized_bookmark_contents)<br><br>print(&quot;Bookmarks have been organized and saved to &#39;organized_bookmarks.md&#39;.&quot;)</pre><p><strong>Example Output:</strong></p><pre>##### Technology <br>- [Python 3.13.0 Documentation](https://docs.python.org/3/)<br>- [Kubernetes Documentation | Kubernetes](https://kubernetes.io/docs/home/)<br><br>##### Science <br>- [NASA](https://www.nasa.gov/)<br>- [NASA Science](https://science.nasa.gov/)<br>- [Indian Space Research Organisation](https://www.isro.gov.in/)<br><br>##### Travel &amp; Lifestyle <br>- [MakeMyTrip - #1 Travel Website 50% OFF on Hotels, Flights &amp; Holiday](https://www.makemytrip.com/)<br>- [Book Flights, Hotels, Holidays, Bus &amp; Train Tickets - EaseMyTrip.com](https://www.easemytrip.com/)<br>- [Tripadvisor: Over a billion reviews &amp; contributions for Hotels, Attractions, Restaurants, and more](https://www.tripadvisor.in/)<br>- [WebMD - Better information. Better health.](https://www.webmd.com/)<br><br>##### Entertainment <br>- [News - Latest News, Breaking News, Bollywood, Sports, Business and Political News | Times of India](https://timesofindia.indiatimes.com/)<br>- [Breaking News Today, Top Headlines, Live Updates | The Hindu](https://www.thehindu.com/)<br><br>##### Finance <br>- [Zerodha: Online brokerage platform for stock trading &amp; investing](https://zerodha.com/)<br>- [Kuvera - Invest in Mutual Funds, Fixed Deposits , Stocks and more](https://kuvera.in/)</pre><p><strong>Conclusion:<br></strong>This simple project not only helped me organize my bookmarks but also gave me the opportunity to learn and practice parsing files and working with Python in more practical way. Using a config file to define categorization rules makes it easy to update and scale it with more bookmarks.</p><p>I hope this inspires you to start automating some of your personal tasks with Python. If you have any questions or want to discuss further, feel free to reach out!</p><p>You can find the complete source code for this project in the GitHub repository:</p><p><a href="https://github.com/vpriyankaprabhu/Bookmark-Categorization.git">GitHub - vpriyankaprabhu/Bookmark-Categorization: Effortless Bookmark Categorization with Custom Rules</a></p><p>Feel free to explore the code and contribute!</p><blockquote>#Python #LearningJourney #BookmarksOrganizer #Consistency</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfec4475d176" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>