In this video, we will scrape results from the World Cup using BeautifulSoup, store the scraped data with Django's ORM, and use the data to produce a Plotly bar chart of the highest scoring teams in the tournament.
This video will demonstrate how you can turn unstructured web/HTML data into a structured format in the database, and produce meaningful charts that give insight into that data.
We will scrape the fixture data from the BBC results pages: https://www.bbc.com/sport/football/wo...
Starter code is available here: https://github.com/bugbytes-io/django...
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:52 Scraping World Cup results with Django management command
02:46 Defining a list of URLs to scrape data from the BBC
06:59 Extracting URL code to a dedicated model-method
07:56 Sending requests to get HTML content with the requests Python module
08:36 Extracting data from webpage with BeautifulSoup
13:09 Adding scraped data to the database with Django model
14:20 Fetching data in a Django view
15:41 Using Django Q Objects for OR expression
19:24 Plotting goals scored as Plotly bar-chart
▶️ Full Playlist:
• Django, Charts and Data Visualization
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲:
To support the channel and encourage new videos, please consider buying me a coffee here:
https://ko-fi.com/bugbytes
𝗦𝗼𝗰𝗶𝗮𝗹 𝗠𝗲𝗱𝗶𝗮:
📖 Blog: https://www.bugbytes.io/posts/
👾 Github: https://github.com/bugbytes-io/django...
🐦 Twitter: / bugbytesio
📚 𝗙𝘂𝗿𝘁𝗵𝗲𝗿 𝗿𝗲𝗮𝗱𝗶𝗻𝗴 𝗮𝗻𝗱 𝗶𝗻𝗳𝗼𝗿𝗺𝗮𝘁𝗶𝗼𝗻:
Plotly Bar Charts: https://plotly.com/python/bar-charts/
Django Q-Objects: https://docs.djangoproject.com/en/4.1...
BeautifulSoup: https://beautiful-soup-4.readthedocs....
BBC World Cup Fixtures: https://www.bbc.com/sport/football/wo...
Github Starter Code: https://github.com/bugbytes-io/django...
#django #python #beautifulsoup