#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUICloseOnESC", 0)
;Opt("TrayIconHide", 1)
;$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
Global $_clipTitlte
Func getHayGheLink($haygheUrl)
;extract clip id
;$haygheUrl = "http://hayghe.clip.vn/watch/?movie=/play/7962/co-giao-sat-nhan/tap/3"
$srcFile = "src"
$downloaded = InetGet($haygheUrl, $srcFile)
if $downloaded then
$src = FileRead($srcFile)
$p1 = StringInStr($src, "player.swf?id=")
If $p1 = 0 then Return false
$p1 = $p1 + StringLen("player.swf?id=")
$p2 = StringInStr($src, "&", 0,1,$p1)
$clipId = StringMid($src, $p1, $p2 - $p1)
$downloaded = InetGet("http://clip.vn/movies/nfo/" & $clipId, $srcFile)
If $downloaded Then
$src = FileRead($srcFile)
$p1 = StringInStr($src, "<enclosure url='")
If $p1 = 0 then Return false
$p1 = $p1 + StringLen("<enclosure url='")
$p2 = StringInStr($src, "'", 0,1,$p1)
$clipUrl = StringMid($src, $p1, $p2 - $p1)
$_clipTitle =getDataBetWeen($src, "<title><![CDATA[", "]]></title>")
$arr = StringRegExp($src, "movie=(/play/[^])")
$ret = $clipUrl
Return $ret
Else
Return false
EndIf
Else
Return false
Endif
EndFunc
Func Alert($msg)
MsgBox(0, _UnicodeURLDecode("Phùng Văn Huy"), $msg)
EndFunc
Func RunApp()
Local $msg
Global $_clipTitle
$text = ChrW(76) & ChrW(7845) & ChrW(121) & ChrW(32) & ChrW(108) & ChrW(105) & ChrW(110) & ChrW(107) & ChrW(32) & ChrW(116) & ChrW(7915) & ChrW(32) & ChrW(104) & ChrW(97) & ChrW(121) & ChrW(103) & ChrW(104) & ChrW(101) & ChrW(46) & ChrW(99) & ChrW(108) & ChrW(105) & ChrW(112) & ChrW(46) & ChrW(118) & ChrW(110)
GUICreate($text, 310, 100) ; will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box
$txtUrl = GUICtrlCreateInput("http://hayghe.clip.vn/watch/?movie=/play/7962/co-giao-sat-nhan/tap/3", 5, 5, 250, 25)
$btnGet = GUICtrlCreateButton("&Get", 260, 5, 45, 25)
$txtResult = GUICtrlCreateInput("", 5, 35, 300, 25)
GUICtrlSetColor($txtResult, 0xff0000)
$text = ChrW(76) & ChrW(105) & ChrW(234) & ChrW(110) & ChrW(32) & ChrW(104) & ChrW(7879) & ChrW(32) & ChrW(113) & ChrW(117) & ChrW(97) & ChrW(32) & ChrW(122) & ChrW(97) & ChrW(104) & ChrW(117) & ChrW(58) & ChrW(32) & ChrW(104) & ChrW(117) & ChrW(121) & ChrW(112) & ChrW(118)
$lblStatus = GUICtrlCreateLabel($text, 5, 65, 300, 25)
; Run the GUI until the dialog is closed
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btnGet
$processing = ChrW(273) & ChrW(97) & ChrW(110) & ChrW(103) & ChrW(32) & ChrW(120) & ChrW(7917) & ChrW(32) & ChrW(108) & ChrW(253) & ChrW(46) & ChrW(46) & ChrW(46)
GuiCtrlSetData($lblStatus, $processing)
GUICtrlSetState($btnGet, $GUI_DISABLE)
$haygheUrl = GUICtrlRead($txtUrl)
$clipInfo = GetHayGheLink($haygheUrl)
If $clipInfo then
$clipUrl = $clipInfo
GuiCtrlSetData($txtResult, $clipUrl)
ClipPut($clipUrl)
$smile = ChrW(84) & ChrW(104) & ChrW(7845) & ChrW(121) & ChrW(32) & ChrW(114) & ChrW(7891) & ChrW(105) & ChrW(32) & ChrW(110) & ChrW(104) & ChrW(225) & ChrW(32) & ChrW(94) & ChrW(46) & ChrW(94) & ChrW(44) & ChrW(32) & ChrW(112) & ChrW(97) & ChrW(115) & ChrW(116) & ChrW(101) & ChrW(32) & ChrW(108) & ChrW(105) & ChrW(110) & ChrW(107) & ChrW(32) & ChrW(116) & ChrW(104) & ChrW(111) & ChrW(97) & ChrW(105) & ChrW(46)
GuiCtrlSetData($lblStatus, $smile & _UnicodeURLDecode(" " & $_clipTitle))
Else
$cry = ChrW(72) & ChrW(101) & ChrW(109) & ChrW(32) & ChrW(116) & ChrW(104) & ChrW(7845) & ChrW(121) & ChrW(32) & ChrW(103) & ChrW(236) & ChrW(32) & ChrW(126) & ChrW(46) & ChrW(126)
GuiCtrlSetData($lblStatus, $cry)
EndIf
GUICtrlSetState($btnGet, $GUI_ENABLE)
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>Example1
Func getDataBetWeen($src, $x, $y)
$p1 = StringInStr($src, $x)
If $p1 = 0 then Return false
$p1 = $p1 + StringLen($x)
$p2 = StringInStr($src, $y, 0,1,$p1)
If $p2 = 0 then Return false
$ret = StringMid($src, $p1, $p2 - $p1)
return $ret
EndFunc
RunApp()
;===============================================================================
; _UnicodeURLEncode()
; Description: : Encodes an unicode string to be URL-friendly
; Parameter(s): : $UnicodeURL - The Unicode String to Encode
; Return Value(s): : The URL encoded string
; Author(s): : Dhilip89
; Note(s): : -
;
;===============================================================================
Func _UnicodeURLEncode($UnicodeURL)
$UnicodeBinary = StringToBinary ($UnicodeURL, 4)
$UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1)
$UnicodeBinaryLength = StringLen($UnicodeBinary2)
Local $EncodedString
For $i = 1 To $UnicodeBinaryLength Step 2
$UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2)
If StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", BinaryToString ('0x' & $UnicodeBinaryChar, 4)) Then
$EncodedString &= BinaryToString ('0x' & $UnicodeBinaryChar)
Else
$EncodedString &= '%' & $UnicodeBinaryChar
EndIf
Next
Return $EncodedString
EndFunc ;==>_UnicodeURLEncode
;===============================================================================
; _UnicodeURLDecode()
; Description: : Tranlates a URL-friendly string to a normal string
; Parameter(s): : $toDecode - The URL-friendly string to decode
; Return Value(s): : The URL decoded string
; Author(s): : nfwu, Dhilip89
; Note(s): : Modified from _URLDecode() that's only support non-unicode.
;
;===============================================================================
Func _UnicodeURLDecode($toDecode)
Local $strChar = "", $iOne, $iTwo
Local $aryHex = StringSplit($toDecode, "")
For $i = 1 To $aryHex[0]
If $aryHex[$i] = "%" Then
$i = $i + 1
$iOne = $aryHex[$i]
$i = $i + 1
$iTwo = $aryHex[$i]
$strChar = $strChar & Chr(Dec($iOne & $iTwo))
Else
$strChar = $strChar & $aryHex[$i]
EndIf
Next
$Process = StringToBinary (StringReplace($strChar, "+", " "))
$DecodedString = BinaryToString ($Process, 4)
Return $DecodedString
EndFunc ;==>_UnicodeURLDecode
Title:
Get link from hayghe.clip.vn
Description:
#NoTrayIcon #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUICloseOnESC", 0) ;Opt("Tray...
...
Rating:
4