| 
									
										
										
										
											2022-12-16 18:38:17 +00:00
										 |  |  | function costco-fuel-price { | 
					
						
							|  |  |  | ## Get website data with curl | 
					
						
							|  |  |  | ## Change Store location to closest location | 
					
						
							|  |  |  | costco_gateshead_site=$(curl -s https://www.costco.co.uk/store-finder/Gateshead) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Grep text from website for different fuel | 
					
						
							|  |  |  | costco_diesel=$(echo $costco_gateshead_site | grep -oP '"gas-title">Premium Diesel</span></br> <span class="gas-price">\K.*' | grep -oE '^.{5}') | 
					
						
							|  |  |  | costco_premium_unleaded=$(echo $costco_gateshead_site | grep -oP '"gas-title">Premium Unleaded Petrol</span></br> <span class="gas-price">\K.*' | grep -oE '^.{5}') | 
					
						
							|  |  |  | costco_unleaded=$(echo $costco_gateshead_site | grep -oP '"gas-title">Unleaded Petrol</span></br> <span class="gas-price">\K.*' | grep -oE '^.{5}') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Print fuel prices | 
					
						
							|  |  |  | echo "Premium Diesel - $costco_diesel p" | 
					
						
							| 
									
										
										
										
											2024-10-06 11:56:06 +00:00
										 |  |  | echo "Premium Unleaded - $costco_premium_unleaded p" | 
					
						
							| 
									
										
										
										
											2022-12-16 18:38:17 +00:00
										 |  |  | echo "Unleaded - $costco_unleaded p" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 |