Skip to main content
deleted 10 characters in body
Source Link
user42643
user42643

AutoIt, 440 bytes

Yes, it's long, but it's stable.

#include<IE.au3> #include<GDIPlus.au3> Func _($0='') _GDIPlus_Startup() $1=_IECreate('xkcd.com/'&$0) For $3 In $1.document.images ExitLoop $3.title<>'' Next $4=_GDIPlus_BitmapCreateFromMemory(InetRead($3.src),1) $6=_GDIPlus_ImageGetDimension(_GDIPlus_BitmapCreateFromHBITMAP($4)) GUICreate(ToolTip($3.title),$6[0],$6[1]) GUICtrlSendMsg(GUICtrlCreatePic('',0,0,$6[0],$6[1]),370,0,$4) _IEQuit($1) GUISetState() Do Until GUIGetMsg()=-3 EndFunc 

First of all, this doesn't use RegEx to scrape the site (because I have no time to test this on all comics), but rather uses the Internet Explorer API to iterate through the DOM's img tags until it finds one with a title text.

Then theThe binary stream is read from the image URL and then rendered into a bitmap using GPIPlusGDIPlus. This is then displayed in a nice, auto-sized GUI with an actual tooltip to make it behave almost exactly like the website.

Here's a test case (_(859)):

)

AutoIt, 440 bytes

Yes, it's long, but it's stable.

#include<IE.au3> #include<GDIPlus.au3> Func _($0='') _GDIPlus_Startup() $1=_IECreate('xkcd.com/'&$0) For $3 In $1.document.images ExitLoop $3.title<>'' Next $4=_GDIPlus_BitmapCreateFromMemory(InetRead($3.src),1) $6=_GDIPlus_ImageGetDimension(_GDIPlus_BitmapCreateFromHBITMAP($4)) GUICreate(ToolTip($3.title),$6[0],$6[1]) GUICtrlSendMsg(GUICtrlCreatePic('',0,0,$6[0],$6[1]),370,0,$4) _IEQuit($1) GUISetState() Do Until GUIGetMsg()=-3 EndFunc 

First of all, this doesn't use RegEx to scrape the site (because I have no time to test this on all comics), but rather uses the Internet Explorer API to iterate through the DOM's img tags until it finds one with a title text.

Then the binary stream is read from the image URL and then rendered into a bitmap using GPIPlus. This is then displayed in a nice, auto-sized GUI with an actual tooltip to make it behave almost exactly like the website.

Here's a test case (_(859)):

)

AutoIt, 440 bytes

Yes, it's long, but it's stable.

#include<IE.au3> #include<GDIPlus.au3> Func _($0='') _GDIPlus_Startup() $1=_IECreate('xkcd.com/'&$0) For $3 In $1.document.images ExitLoop $3.title<>'' Next $4=_GDIPlus_BitmapCreateFromMemory(InetRead($3.src),1) $6=_GDIPlus_ImageGetDimension(_GDIPlus_BitmapCreateFromHBITMAP($4)) GUICreate(ToolTip($3.title),$6[0],$6[1]) GUICtrlSendMsg(GUICtrlCreatePic('',0,0,$6[0],$6[1]),370,0,$4) _IEQuit($1) GUISetState() Do Until GUIGetMsg()=-3 EndFunc 

First of all, this doesn't use RegEx to scrape the site (because I have no time to test this on all comics), but rather uses the Internet Explorer API to iterate through the DOM's img tags until it finds one with a title text.

The binary stream is read from the image URL and rendered into a bitmap using GDIPlus. This is then displayed in a nice, auto-sized GUI with an actual tooltip to make it behave almost exactly like the website.

Here's a test case (_(859)):

)

Source Link
user42643
user42643

AutoIt, 440 bytes

Yes, it's long, but it's stable.

#include<IE.au3> #include<GDIPlus.au3> Func _($0='') _GDIPlus_Startup() $1=_IECreate('xkcd.com/'&$0) For $3 In $1.document.images ExitLoop $3.title<>'' Next $4=_GDIPlus_BitmapCreateFromMemory(InetRead($3.src),1) $6=_GDIPlus_ImageGetDimension(_GDIPlus_BitmapCreateFromHBITMAP($4)) GUICreate(ToolTip($3.title),$6[0],$6[1]) GUICtrlSendMsg(GUICtrlCreatePic('',0,0,$6[0],$6[1]),370,0,$4) _IEQuit($1) GUISetState() Do Until GUIGetMsg()=-3 EndFunc 

First of all, this doesn't use RegEx to scrape the site (because I have no time to test this on all comics), but rather uses the Internet Explorer API to iterate through the DOM's img tags until it finds one with a title text.

Then the binary stream is read from the image URL and then rendered into a bitmap using GPIPlus. This is then displayed in a nice, auto-sized GUI with an actual tooltip to make it behave almost exactly like the website.

Here's a test case (_(859)):

)