 Okay, today we're gonna be looking at FAV icons a little bit and when you go to a website in the tabs here You can see little icons that are different for each site if they have some set You can set a default one for your entire website or individual ones for pages These are also useful when people are creating shortcuts on their computers or phones It adds a nice looking icon that is recognizable, but I want I needed for a project I was working on a bash script that would grab the FAV icon. So real quick. Let's look at the HTML for this page on my website. So when I look at this you can see I have a list of FAV icons here and They're all different sizes and formats. This is generated with a with some code For different formats you could have just one, but it's nice to have different sizes for different Platforms and simple enough to do so the issue I had and I tried looking up if there was a tool or something That feel like this that already exists in there Maybe but I didn't find anything right off the bat But here so I'm looking in this current for this page a sub directory Icons, but that could be called anything. That's just what I call it for most of my sites But it could be something different It could be a full path with the domain name and to a directory somewhere on the site And then some people like here I just have icons meaning in this current directory going to the sub folder called icons Some people put dot slash which is probably a little more correct so I started off by writing off writing out a script that would look for these links and Then it would check the first character if it was a forward slash and grab domain put that beginning if it was a dot Then don't if it started with HTTP then use the whole thing and I know that that was just a horrible way of going about it I would have to do multiple lines of code. I came up with a simpler way now My code is very simple I have not tested out a whole bunch of sites But so far it's working for my needs and it's grabbing whatever the first fab icon is which it may not be the highest resolution so my code can be improved upon but I wanted to share what I've created so far with you and Basically to look at solving that getting the full URL for the fab icon Regardless of how it's written here in the href. So here we go. I'm gonna take this URL here and In my director, I have my fab icon underscore get is what I called my script when I hit enter I give it a URL. I press enter again, and it spits out again the first fab icon in the list And I can click on that and we can go to it. There we go That's the icon that I use for my little note search now Let's look at my my code here and see exactly what I did Well, actually no before we do that. Let's just let's assert typing some stuff out So again, I can use W get dash Q capital O dash and give it the URL and this will dump out The HTML from the page, right? So we got that and then I can Grip fab and get some of the information want here, but again, here's the issue We don't have the few full URL now W get does have an option it where it will create the full URLs for all links on the page Net command is the K or switch is the K command, but there's a problem doing it this way I don't know exactly why it can't do this No, hey, that's where it's going to give me an error And the problem is it can't spit out to standard output when using the K option So basically I need to dump this to a file and then rep through the file So I'm going to instead of dumping it to standard output. I'll just say Fab dot icon, that's not really a good file name But I'm just going to name it that and if I open up that fab dot icon file I can go into it and we can see here that it has given us the full URLs for all everything Everything that's whether it's a full path or not originally We now have the full URLs to everything that's href. So now I can take that I Can rep for fab from that file and you can see my fab icon. Let's look at my actual code Fav icon get whoops Let's try that again without my finger slipping Make this a little bit smaller So the way my code works is it's going to ask you for a URL And then it's going to check to make sure you actually entered something if not at X It's really it'd be better if I actually checked to make sure it's a URL You know make sure it starts with HTTP probably be better But here it's just checking. Did you input something otherwise exit then we're getting a variable for where we're going to store that file And then we're going to pull down that URL to this file and then here I'm going to cat for this and I'm gonna this is this is the part where I'm basically just cutting and Slicing and searching through the file to find the very first fab icon in the list This is part that might be able to be approved upon because different sites may have Different HTML, but so far all the sites I've worked on I've tested it This works and then it spits out that that URL to that fab icon again It's spitting out the first one the list which may not be the best quality option But for my project right now that it's at least a start. I have put this code up on pay spin So there's the URL I'll try to remember put that in the description of this video But go ahead and check that out if you have improvements Make the improvements post them somewhere and put the URL in the description below to let us know because it definitely this could Definitely be improved on but again There's just quick and dirty to get done what I need to get done today, and I thought I would share it with you I do. Thank you for watching. Please visit films by Chris calm That's Chris decay. There's a link in the description and as always. I hope that you have a great day