<?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"><channel><title><![CDATA[Political News Summaries]]></title><description><![CDATA[Political News Summaries]]></description><link>https://political-news-summaries.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 15:13:57 GMT</lastBuildDate><atom:link href="https://political-news-summaries.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[📰 Scraping and Summarizing Kenyan Political News with Python]]></title><description><![CDATA[In this blog, I’ll walk you through how I built a Python script that scrapes political news from Standard Media Kenya, summarizes each article using NLP…]]></description><link>https://political-news-summaries.hashnode.dev/scraping-and-summarizing-kenyan-political-news-with-python</link><guid isPermaLink="true">https://political-news-summaries.hashnode.dev/scraping-and-summarizing-kenyan-political-news-with-python</guid><category><![CDATA[nlp]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[webscraping ]]></category><category><![CDATA[modules]]></category><category><![CDATA[GitHub]]></category><dc:creator><![CDATA[kasumbi phil]]></dc:creator><pubDate>Sat, 02 Aug 2025 07:14:13 GMT</pubDate><content:encoded><![CDATA[<p>In this blog, I’ll walk you through how I built a Python script that scrapes political news from <a target="_blank" href="https://www.standardmedia.co.ke/category/3/politics">Standard Media Kenya</a>, summarizes each article using NLP, and saves the results to a <code>.txt</code> file.</p>
<hr />
<h3 id="heading-what-i-built">🛠️ What I Built</h3>
<p>I wanted a simple tool to help me stay up to date with Kenyan politics — without manually reading every article.</p>
<p>So I built a Python script that:</p>
<ul>
<li><p>Scrapes article links from the <em>Politics</em> section</p>
</li>
<li><p>Downloads and parses the full article using <code>newspaper3k</code></p>
</li>
<li><p>Summarizes each article into 3 sentences using <code>Sumy</code> (LexRank)</p>
</li>
<li><p>Saves the title, URL, summary, and full text to a <code>.txt</code> file</p>
</li>
</ul>
<hr />
<h3 id="heading-tools-and-libraries-used">🧠 Tools and Libraries Used</h3>
<ul>
<li><p><code>requests</code> + <code>BeautifulSoup</code> — for scraping</p>
</li>
<li><p><code>newspaper3k</code> — for extracting full article text</p>
</li>
<li><p><code>sumy</code> — for summarizing using LexRank</p>
</li>
<li><p><code>nltk</code> — for tokenization</p>
</li>
<li><p><code>time</code> — for basic delays (not used for auto-scheduling now)</p>
</li>
</ul>
<hr />
<h3 id="heading-what-i-struggled-with">⚠️ What I Struggled With</h3>
<p><strong>🔗 Problem:</strong> Many URLs were either incomplete or unusable<br /><strong>✅ Fix:</strong> I checked and cleaned URLs early before passing to <code>Article()</code>.</p>
<p><strong>📄 Problem:</strong> Some articles didn’t load or were empty<br /><strong>✅ Fix:</strong> Wrapped downloads in a <code>try-except</code> block to skip broken links safely.</p>
<p><strong>📝 Problem:</strong> Summaries were hard to read in the output<br /><strong>✅ Fix:</strong> Clean formatting and line breaks made the <code>.txt</code> readable.</p>
<hr />
<h3 id="heading-output">📁 Output</h3>
<p>The <code>.txt</code> file contains:</p>
<ul>
<li><p>✅ Title of each article</p>
</li>
<li><p>✅ Link to the article</p>
</li>
<li><p>✅ 3-sentence summary</p>
</li>
</ul>
<p>Each article is neatly separated with clear headings and lines.</p>
<hr />
<h3 id="heading-github-repo">📦 GitHub Repo</h3>
<p>🔗 <a target="_blank" href="https://github.com/philkasumbi/Kenya-Politics-News-Scraper-Summarizer.git">View the full project on GitHub</a>  </p>
<hr />
<h3 id="heading-final-thoughts">💡 Final Thoughts</h3>
<p>This small but powerful project helped me improve my scraping and NLP skills. If you’re looking to automate news consumption or build a simple NLP tool, this is a great place to start.</p>
]]></content:encoded></item></channel></rss>