Jump to content

Getting the location of a favicon from link


Recommended Posts

trying to use this udf

but the _HTML_Get() function is almost always returning an empty string. Especially if the link is in a sub domain(?)

I'm horrible at regexp so I'm not sure how it's searching to fix the problem. Or maybe there is a better way to get the full path to a favicon?

#include <_html.au3>
Local $url[3]
$url[0] = "[url="http://www.autoitscript.com/autoit3/index.shtml"]http://www.autoitscript.com/autoit3/index.shtml[/url]"
$url[1] = "[url="http://www.imdb.com/"]http://www.imdb.com/[/url]"
$url[2] = "[url="http://www.homedepot.com/Doors-Windows-Doors-Entry-Doors-Screen-Doors/h_d1/N-5yc1vZbaed/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&storeId=10051&currentPLP=true&omni=c_Screen"]http://www.homedepot.com/Doors-Windows-Doors-Entry-Doors-Screen-Doors/h_d1/N-5yc1vZbaed/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&storeId=10051&currentPLP=true&omni=c_Screen[/url] Doors&searchNav=true"
For $i = 0 to UBound($url)-1
 $sHTML = _HTML_GetSource($url[$i])
 $sIconURL = _HTML_Get($sHTML, "link", "href", "image/x-icon", "type")
 MsgBox(0,$url[$i],$sIconURL)
Next

_HTML.au3

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

hmm, nothing so far?

Well, I tried to start with just the .com part, then add sub domains durring a loop if the icon was not found, but it's still not finding :(

#include <_html.au3>
Local $url[3]
$url[0] = "http://www.autoitscript.com/autoit3/index.shtml"
$url[1] = "http://www.imdb.com/"
$url[2] = "http://www.homedepot.com/Doors-Windows-Doors-Entry-Doors-Screen-Doors/h_d1/N-5yc1vZbaed/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&storeId=10051&currentPLP=true&omni=c_Screen Doors&searchNav=true"
$sIconURL = ""
For $i = 0 to UBound($url)-1
 $split = StringSplit($url[$i],"/")
 $combine = $split[1]&"/"
 For $z = 3 To UBound($split) - 1
  $combine = $combine&"/"&$split[$z]
  $sHTML = _HTML_GetSource($combine)
  $sIconURL = _HTML_Get($sHTML, "link", "href", "image/x-icon", "type")
  If $sIconURL <> "" Then
   MsgBox(0,$combine,$sIconURL)
   ExitLoop
  EndIf
 Next
 If $sIconURL = "" Then
  MsgBox(0,$url[$i],"No favicon found")
 EndIf
Next

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

  • 3 weeks later...

Using getfavicon.appspot.com website you can download your Favicons like this :

Global $url[3]

$url[0] = "http://www.autoitscript.com/autoit3/index.shtml"
$url[1] = "http://www.imdb.com/"
$url[2] = "http://www.homedepot.com/Doors-Windows-Doors-Entry-Doors-Screen-Doors/h_d1/N-5yc1vZbaed/h_d2/Navigation?catalogId=10053&Nu=P_PARENT_ID&langId=-1&storeId=10051&currentPLP=true&omni=c_Screen Doors&searchNav=true"

For $i = 0 to UBound ( $url ) -1
    INetGet ( 'https://getfavicon.appspot.com/' & $url[$i], @DesktopDir & '\' & $i & '.ico', 1+2+8 )
Next

But attention, it can be a gif or png filetype too ! ;)

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...