네트워커의 보안 티스토리

웹툰제목파싱.ahk

웹툰제목파싱.exe



URL:="https://comic.naver.com/webtoon/weekday.nhn"


winHttp := ComObjCreate("WinHttp.WinHttpRequest.5.1") 

winHttp.Open("GET",URL) ;

winHttp.Send("") 

winHttp.WaitForResponse( ) ;


a:=winHttp.ResponseText 


;msgbox, %a%

;clipboard:=a


msgbox, % IndentScript(a)

Clipboard:= % IndentScript(a)

exitapp



IndentScript(LVData)

{

global IndentStr

pos = 1 ; 연속 서치를 위해


while(pos := RegExMatch(LVData, "sU)class=""title"" title=""(.*)"">" ; 제목

, match, pos + strlen(match)))

{

name_result = %name_result%`n%match1%

count := % A_index

}

StringSplit, name, name_result, `n


pos = 1


while(pos := RegExMatch(LVData, "U)titleId=(.*)onclick=" ; 클래스 아이디

, matcha, pos + strlen(matcha)))

{

matcha1 := RegExReplace(matcha1, "\D") ;숫자만 추출

id_result = %id_result%`n%matcha1%

}

StringSplit, id, id_result, `n


n=2

Loop

{

 ; 1은 빈줄이라 2부터 읽어오게함

 

mid_result :=  name%n% " : " id%n% 

if(n=2)

total_result = %mid_result%

else

total_result = %total_result%`n%mid_result%


if(n>count)

break


n++

}


return total_result


}