<?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 Miebi Williams on Medium]]></title>
        <description><![CDATA[Stories by Miebi Williams on Medium]]></description>
        <link>https://medium.com/@williamsmiebi?source=rss-a9c605f390a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vPjNYly5TGOKQe9Z.jpg</url>
            <title>Stories by Miebi Williams on Medium</title>
            <link>https://medium.com/@williamsmiebi?source=rss-a9c605f390a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:20:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@williamsmiebi/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[Web scraping and analysis Using AI]]></title>
            <link>https://medium.com/@williamsmiebi/web-scraping-and-analysis-using-ai-e1b18229d09a?source=rss-a9c605f390a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1b18229d09a</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[storytelling]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[Miebi Williams]]></dc:creator>
            <pubDate>Mon, 18 Sep 2023 07:36:02 GMT</pubDate>
            <atom:updated>2023-09-18T07:36:02.498Z</atom:updated>
            <content:encoded><![CDATA[<p>I wanted to practice web scraping using the beautiful soup library, but I was faced with a challenge that every beginner data analyst faces; getting raw data. I needed raw real-life data so that I could derive insights. I looked around and thought a bit and decided to do what may be a bit unconventional and some may even consider unprofessional. I decided to scrape data from your favorite website 😜; <a href="http://www.xvideos.com/">www.xvideos.com</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*MLXGzOsApu5MfcVt.gif" /></figure><h3><strong>Insights</strong></h3><p>After deciding where to get my data from for the web scraping project, the next necessary question was, What kind of information do I intend to obtain from the data gotten from the website, What do I intend to get from the data obtained from the website?</p><p>1. I decided I wanted to see the most searched terms/phrases on the website at the time.</p><p>2. And the least searched phrases on the website.</p><h3><strong>Importing The Required Libraries</strong></h3><p>To get the Open AI library up and running, you have to sign up on the website; <a href="http://platform.openai.com/">platform.openai.com</a> to get your API after installing the OpenAI library on your console using the <em>“pip install pandasai” </em>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66wmUuxzR69IVCQdiu235g.png" /><figcaption>library importation</figcaption></figure><h3><strong>Gathering Data</strong></h3><p>To gather the data, I used the requests library to obtain the website and parsed the HTML using the beautiful Soup Library. The output has to be 200 after running the code to show the request is successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*plE9TwR08pHVaMOqUD1cvw.png" /></figure><p>The whole html is obtained and at this point, it doesn&#39;t make much sense at first glance. However, everything we need is in the jargon below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WPw0ZPp0rCw_iAMaihUmYw.png" /></figure><p>I had to chisel away some dirt to get closer to revealing the beauty in the rough. To do this, I inspected the website carefully(<em>without getting too kinky 😜</em>) to find the tag that was used. After which the data was placed in a text format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xmS-6nZbGw5LqMFguDOfcg.png" /></figure><p>The obtained data is in text format and needs to be put in a format for easy manipulation. I used the famous Pandas library to convert the data from a text format to a data frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*I8VK83TL3RK68HynuCV_dw.png" /></figure><p><em>Phew! 😅</em></p><p>I had my data now ready to go, but not ready for analysis of any kind, it was full of all sorts of jargon. After manually scrolling through hundreds of rows of data, I observed that there were certain rows that weren&#39;t search terms(<strong><em>because I use the website, so I’ll know.. 😝</em></strong>). Those rows of data had to go. I dropped the rows using their index, I think there is a better way of dropping them, but I&#39;m not so sure. <strong>(<em>Don’t be lazy like me and dig it up</em></strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZxneCDfckreN3-AgequYw.png" /></figure><p>I encountered a little problem after scraping the searched words on the website, the data frame was just a categorical data frame with no numbers reflecting the count of each word searched. I needed to create a data frame with at least two features to make any sense. To achieve this, I scraped the website again, using the aforementioned procedure with beautiful soup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*hs-etLBz0tFW477uESHF6A.png" /><figcaption>Scraping xvideos.com for tag counts.</figcaption></figure><p>Like the keywords, some other data was obtained from the website that was not related to the frequency of the keyword search. I had to get rid of them by manually looking through and comparing them with the website the data was obtained from for the keyword count to correspond. After manually going through them, I deleted them using the drop function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbrMBuYWbyYBv9EQFgQI1g.png" /></figure><p>Now I have two data features I need but in the form of data frames separate from each other like Lost Lovers. They have to be joined for the love of data!</p><h3>Joining Dataframes</h3><p>By the power vested in me by the God of insights, I hereby concat these two data frames as husband and wife. 🙏</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*631ldqfX8ASvCIsn5tnqkw.png" /><figcaption>Holy <strong><em>concatrimony</em></strong> of data frames. 😏</figcaption></figure><p>After the join there was a slight problem, the data frames were not properly aligned as they were supposed to be. There is a slight disarrangement between both columns, the “0-pussy” keyword on the website has a count of 200,869. This upsets the other rows of data as well. To make this correction, I exported the data frame as a CSV file and made the correction easily in a spreadsheet. After a little tweak in Microsoft Excel, we had a proper alignment with both data frames.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*ftG1U-FyqSMqOw9z2Wq9MA.png" /></figure><p><strong>Exploring the data: </strong>To ensure none of the keywords appears twice in the data frame, I employed the use of the value_counts function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmYl1vY4UNW5HOMPzzUf2Q.png" /></figure><p><strong>DATA WRANGLING: </strong>I stripped the data of<strong><em> </em></strong>the dirt by checking for duplicates, deleted unwanted characters, converted columns into the required formats, and dropped keywords with a count of zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*gLMEiO38zm9wDe_DlxlWig.png" /></figure><h3><strong>STATISTICS USING OPENAI</strong></h3><p>This part was the simplest, all I had to do was type in the statistical parameter I wanted in the prompt and openAI generated it based on the data I fed it. It’s like asking a human being to carry out a specific task, the only difference is, that it’s a lot faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zbupEa3RlznwX3FwtTQqg.png" /></figure><h3><strong>ANALYSIS</strong></h3><p><strong>VISUALIZATION: </strong>Once again I employed the use of OpenAI to create a simple barplot to illustrate the 10 least searched key phrases. I also created a barplot myself by creating a sub-data frame containing only the 10 most searched phrases before plotting using the Seaborn library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*qsoNYyXWxF4x8HaVcu3yeA.png" /><figcaption>barplot of most searched phrases.</figcaption></figure><h4>Creating word Cloud</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q2HDD8cObQsQTwHACbOeHQ.jpeg" /></figure><p>This part of the project was the most stressful for me because it took me a while to find a proper image for the mask that fits the theme of the analysis properly. I was eventually able to find a free website to create a cloud image from<a href="https://www.wordclouds.com/"> https://www.wordclouds.com/</a> After creating the image I imported a few extra libraries to help in the creation of the word cloud, I created a list of strings from the keyword column to be used for the word cloud and created the word cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*Et2cvPPUuDfACBeEeJ_gIw.png" /></figure><h3>CONCLUSION</h3><p>This was a fun project that I took on to get a grasp of certain concepts, initially, I didn&#39;t plan on using AI for the project, but in the course of working on it I stumbled across an article(<a href="https://medium.com/@fareedkhandev/pandas-ai-the-future-of-data-analysis-8f0be9b5ab6f">https://medium.com/@fareedkhandev/pandas-ai-the-future-of-data-analysis-8f0be9b5ab6f</a>) written by <a href="https://medium.com/u/b856005e5ecd">Fareed Khan</a> on the use of OpenAI and I decided to incorporate it. I know it’s sexually explicit and there are a myriad of flaws in the project, but I am open to suggestions and corrections. I just want to learn as much as I can and have fun doing it.</p><p>Here’s the link to the full github repo : <a href="https://github.com/Montana-Sosa/XVIDS-SCRAPING">https://github.com/Montana-Sosa/XVIDS-SCRAPING</a></p><p>If you enjoyed this article and like unconventional write-ups about the data space, kindly follow me, drop a comment, or reach out to me to collaborate on a project or give me a job😃.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1b18229d09a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>