Jump to content

Protectlinks decoder and Rapidshare links checker


Jex
 Share

Recommended Posts

That script decoding protectlinks ( Picture 1 = Decoding, Picture 2 = Decoded links. ) or checking rapidshare links for working or not ( Picture 2 = After check. ) .

For test example links :

1 - http://www.protectlinks.com/38282
2 - http://www.protectlinks.com/38283
3 - http://www.protectlinks.com/38284
4 - http://www.protectlinks.com/38285
5 - http://www.protectlinks.com/38286

Posted Image

Posted Image

#include <GuiEdit.au3>
#include <INet.au3>
#include <IE.au3>
#include <String.au3>
#include <GUIConstants.au3>

$Form = GUICreate("Protectlinks decoder and Rapidshare checker", 400, 300)
$oIE = _IECreateEmbedded()
$Edit = GUICtrlCreateEdit("", 10, 10, 380, 250)
$Button = GUICtrlCreateButton("Protectlinks decode", 10, 265, 185, 25)
$Button2 = GUICtrlCreateButton("Rapidshare links check", 200, 265, 190, 25)
$GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, 1, 1)
GUICtrlSetState($GUIActiveX, $GUI_HIDE)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Button
            Hidecontrols()
            $Count = _GUICtrlEdit_GetLineCount ($Edit)
            $Data = ""
            For $i = 0 To $Count - 1
                GUICtrlSetData($Button, $i + 1 & "/" & $Count & "  " & Round(((($i + 1) / ($Count)) * 100), 0) & "%")
                $Line = _GUICtrlEdit_GetLine ($Edit, $i)
                Check()
            Next
            GUICtrlSetData($Edit, $Data)
            Showcontrols()
        Case $Button2
            Hidecontrols()
            GUICtrlSetState($Button2, $GUI_DISABLE)
            GUICtrlSetState($Button, $GUI_DISABLE)
            GUICtrlSetState($Edit, $GUI_DISABLE)
            GUICtrlSetData($Button2, "Loading...")
            _IENavigate($oIE, "http://rapidshare.com/en/checkfiles.html")
            $Box = _IEGetObjByName($oIE, "urls")
            $Count = _GUICtrlEdit_GetLineCount ($Edit)
            For $i = 0 To $Count
                $Line = _GUICtrlEdit_GetLine ($Edit, $i)
                If $i = 0 Then
                    $Data = $Line
                Else
                    $Data = $Data & @CRLF & $Line
                EndIf
            Next
            _IEFormElementSetValue($Box, $Data)
            $Submit = _IEFormGetCollection($oIE, 0)
            _IEFormSubmit($Submit)
            $Source2 = _IEDocReadHTML($oIE)
            Check2()
            Showcontrols()
        Case - 3
            Exit
    EndSwitch
WEnd

Func Check()
    If StringInStr($Line, "protectlinks") Then
        $Split = StringSplit($Line, "com/", 1)
        $Source = _INetGetSource("http://www.protectlinks.com/redirected.php?id=" & $Split[2])
        $Link = _StringBetween($Source, 'width="100%" src="', '"></iframe>')
        If $i = 0 Then
            $Data = $Link[0]
        Else
            $Data = $Data & $Link[0]
        EndIf
    EndIf
EndFunc   ;==>Check

Func Check2()
    $Strings = _StringBetween($Source2, '<font color="red">File ', ') not found!</font>\n')
    If IsArray($Strings) Then
        $Broken = ""
        $Count = _GUICtrlEdit_GetLineCount ($Edit)
        For $i = 0 To UBound($Strings) - 1
            $Split2 = StringSplit($Strings[$i], " (", 1)
            For $z = 0 To $Count
                $Line = _GUICtrlEdit_GetLine ($Edit, $z)
                If StringInStr($Line, $Split2[1]) Then
                    If $Broken = "" Then
                        $Broken = $Line
                    Else
                        $Broken = $Broken & @CRLF & $Line
                    EndIf
                EndIf
            Next
        Next
        MsgBox("", "", "Found " & UBound($Strings) & " broken link." & @CRLF & $Broken)
    Else
        If StringInStr($Source2, '<font color="green">') Then MsgBox("", "", "All links working!")
    EndIf
EndFunc   ;==>Check2

Func Hidecontrols()
    GUICtrlSetState($Button, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Edit, $GUI_DISABLE)
EndFunc

Func Showcontrols()
    GUICtrlSetData($Button, "Protectlinks Decode")
    GUICtrlSetData($Button2, "Rapidshare links check")
    GUICtrlSetState($Edit, $GUI_ENABLE)
    GUICtrlSetState($Button2, $GUI_ENABLE)
    GUICtrlSetState($Button, $GUI_ENABLE)
EndFunc
Edited by Jex
Link to comment
Share on other sites

Hi Jex,

Your script caught my attention and I though I would give it a try, but ran into a few problems:

First, functions _GUICtrlEdit_GetLineCount and _GUICtrlEdit_GetLine are not included in your post.

I assumed those functions are based upon _GUICtrlEditGetLineCount and _GUICtrlEditGetLine found in the latest GuiEdit.au3 file, so I removed the underscore from their names to see what would happen. When the GUI appeared I pasted the test url's you provided into the $Edit control, and pressed the Decode button. It processed the url's but failed to update the $Edit control with the RapidShare url's or to reset its state to "enabled". That's because the _GUICtrlEditGetLine function is using ByRef (for some reason) for its first parameter and the value of $Edit is being altered.

To get around that issue, I assigned the value of $Edit to variable $XX and used $XX as the parameter to the _GUICtrlEditGetLine function.

I also ran into a counting issue where the last url was not being processed (perhaps with your "GetLine" functions you do not have these issues). I changed "For $i = 0 To $Count - 1" to "For $i = 1 To $Count".

One other issue is if $Edit contains blank lines (including trailing blank lines), or leading spaces, the results are incorrect. I did not do anything about that.

Here's your original code with the changes I made (mine are all outdented):

#include <GuiEdit.au3>
#include <INet.au3>
#include <IE.au3>
#include <String.au3>
#include <GUIConstants.au3>

$Form = GUICreate("Protectlinks decoder and Rapidshare checker", 400, 300)
$oIE = _IECreateEmbedded()
$Edit = GUICtrlCreateEdit("", 10, 10, 380, 250)
$Button = GUICtrlCreateButton("Protectlinks decode", 10, 265, 185, 25)
$Button2 = GUICtrlCreateButton("Rapidshare links check", 200, 265, 190, 25)
$GUIActiveX = GUICtrlCreateObj($oIE, 1, 1, 1, 1)
GUICtrlSetState($GUIActiveX, $GUI_HIDE)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Button
            Hidecontrols()
            $Count = _GUICtrlEditGetLineCount ($Edit)
            $Data = ""
$XX = $Edit
;~             For $i = 0 To $Count - 1
For $i = 1 To $Count
                GUICtrlSetData($Button, $i + 1 & "/" & $Count & "  " & Round(((($i + 1) / ($Count)) * 100), 0) & "%")
;~                 $Line = _GUICtrlEditGetLine ($Edit, $i)
$Line = _GUICtrlEditGetLine ($XX, $i)
                Check()
            Next
            GUICtrlSetData($Edit, $Data)
            Showcontrols()
        Case $Button2
            Hidecontrols()
            GUICtrlSetState($Button2, $GUI_DISABLE)
            GUICtrlSetState($Button, $GUI_DISABLE)
            GUICtrlSetState($Edit, $GUI_DISABLE)
            GUICtrlSetData($Button2, "Loading...")
            _IENavigate($oIE, "[url="http://rapidshare.com/en/checkfiles.html"]http://rapidshare.com/en/checkfiles.html[/url]")
            $Box = _IEGetObjByName($oIE, "urls")
            $Count = _GUICtrlEditGetLineCount ($Edit)
$XX = $Edit
            For $i = 0 To $Count
;~                 $Line = _GUICtrlEditGetLine ($Edit, $i)
$Line = _GUICtrlEditGetLine ($XX, $i)
                If $i = 0 Then
                    $Data = $Line
                Else
                    $Data = $Data & @CRLF & $Line
                EndIf
            Next
            _IEFormElementSetValue($Box, $Data)
            $Submit = _IEFormGetCollection($oIE, 0)
            _IEFormSubmit($Submit)
            $Source2 = _IEDocReadHTML($oIE)
            Check2()
            Showcontrols()
        Case - 3
            Exit
    EndSwitch
WEnd

Func Check()
    If StringInStr($Line, "protectlinks") Then
        $Split = StringSplit($Line, "com/", 1)
        $Source = _INetGetSource("[url="http://www.protectlinks.com/redirectedl.php?id"]http://www.protectlinks.com/redirectedl.php?id[/url]=" & $Split[2])
        $Link = _StringBetween($Source, 'width="100%" src="', '"></iframe>')
        If $i = 0 Then
            $Data = $Link[0]
        Else
            $Data = $Data & $Link[0]
        EndIf
    EndIf
EndFunc   ;==>Check

Func Check2()
    $Strings = _StringBetween($Source2, '<font color="red">File ', ') not found!</font>\n')
    If IsArray($Strings) Then
        $Broken = ""
        $Count = _GUICtrlEditGetLineCount ($Edit)
        For $i = 0 To UBound($Strings) - 1
            $Split2 = StringSplit($Strings[$i], " (", 1)
$XX = $Edit
            For $z = 0 To $Count
;~                 $Line = _GUICtrlEditGetLine ($Edit, $z)
$Line = _GUICtrlEditGetLine ($XX, $z)
                If StringInStr($Line, $Split2[1]) Then
                    If $Broken = "" Then
                        $Broken = $Line
                    Else
                        $Broken = $Broken & @CRLF & $Line
                    EndIf
                EndIf
            Next
        Next
        MsgBox("", "", "Found " & UBound($Strings) & " broken link." & @CRLF & $Broken)
    Else
        If StringInStr($Source2, '<font color="green">') Then MsgBox("", "", "All links working!")
    EndIf
EndFunc   ;==>Check2

Func Hidecontrols()
    GUICtrlSetState($Button, $GUI_DISABLE)
    GUICtrlSetState($Button2, $GUI_DISABLE)
    GUICtrlSetState($Edit, $GUI_DISABLE)
EndFunc

Func Showcontrols()
    GUICtrlSetData($Button, "Protectlinks Decode")
    GUICtrlSetData($Button2, "Rapidshare links check")
    GUICtrlSetState($Edit, $GUI_ENABLE)
    GUICtrlSetState($Button2, $GUI_ENABLE)
    GUICtrlSetState($Button, $GUI_ENABLE)
EndFunc

Phillip

Phillip

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...