Freelancer Site

Web Scraping Freelancer.co.uk

Web scraping is the process of extracting data from websites, allowing you to gather, organize, and compare large amounts of information. This technique can be applied to various fields such as finance, real estate, world statistics, and social media.

In this project, I aimed to scrape Freelancer.co.uk for specific job data to extract only the ones I was interested in and compile them into a personal spreadsheet. I focused on Python-related jobs and used a CSV file along with an Excel spreadsheet to manage the data. My goal was to extract information specific to the date, title, price, description, skills, and URL of each job. I delve into this process in more detail and provide a visual demonstration in a YouTube video on my tech channel.

The main libraries used in this project were Beautiful Soup 4, Requests, and Python's CSV module.

My general approach to web scraping starts with opening the developer tools to examine the site's structure. Websites typically follow a pattern, and the DOM (Document Object Model) can be thought of as a tree-like structure. Using Beautiful Soup 4, I parsed this tree, moving from outer tags to their children, eventually narrowing my search to find key data such as the price or description of each job.

Here’s an example of how I located the job description and price:

      
        description = child.find("p", {"class": "JobSearchCard-primary-description"})
price = child.find('div', {'class': 'JobSearchCard-primary-price'})


A useful technique is to scrape the entire page, save the HTML into a text file, and then parse through it to avoid repeated scraping of the site. This method helps bypass anti-scraping mechanisms some sites employ and prevents getting your IP blocked. Additionally, it reduces the risk of overloading the site’s servers with too many requests in a short period.

Throughout this project, I also learned more about setting up a virtual environment. This is crucial for managing dependencies and ensuring that the project uses the correct versions of libraries without conflicts. Setting up a virtual environment in Python is straightforward using tools like `venv` or `virtualenv`.

This project made me realize that if expanded into a tool allowing users to customize their searches and extract data specific to their needs beyond the current filters, it could significantly benefit freelancers. It could help them find the best job opportunities or receive alerts when relevant jobs are posted.

Overall, I enjoyed this project as an introduction to web scraping! If you're interested in extracting data from a particular site, analyzing it, or bringing an idea to life, don't hesitate to get in touch! Head to the home page and fill out the form. I will contact you with a quote, and we can get started with web scraping!