Jump to content

Get file url and downaload


Recommended Posts

Im trying to make a script that will visit a Rapidshare link, download as a free user, wait the time, and download the file. I can do most of it, but i need help wIth a few things.

1) how can i read the seconds remaining on the page for free users?

2) how can i download the file? Im hoping to use an embedded IE to download it.

Thanks

-rj

Link to comment
Share on other sites

1. The part of the html that displays the time looks like this:<h3 id="zeit" style="font-size: 24pt;"> 24 seconds remaining</h3>.

You can create a reference to this part of the code using _IEGetObjById() and then read ot with _IEPropertyGet(), or

You could read the page source using _IEBodyReadHTML() and evaluate that using StringRegExp, or other String funcions.

2. The part of the html that displays the download link is this: <form method="post" action="http://rs161tg.rapidshare.com/files/97109313/3187077/hot_chocolate_-_every_1_s_a_winner.mp3" name="dlf">.

Id use _IEBodyReadHTML() and evaluate that using StringRegExp to get the link and then InetGet to download it.

Link to comment
Share on other sites

well here is some... "WORKS ON MY MACHINE" code :mellow:

It should at least give you a good start.

#include <IE.au3>
_IEErrorHandlerRegister ()
$URL = 'http://rapidshare.com/files/66065174/040_-_Steely_Dan_-_Reelin__In_The_Years.mp3'
$oIE = _IECreate($URL, 0, 0)
$oForm = _IEFormGetObjByName ($oIE, "ff")
_IEFormSubmit($oForm)
$Wait = StringInStr(_IEBodyReadText($oIE), 'seconds remaining')
While $Wait <> 0
    ConsoleWrite(StringStripWS(StringMid(_IEBodyReadText($oIE), $Wait - 3, 2), 8) & @CRLF)
    Sleep(1000)
    $Wait = StringInStr(_IEBodyReadText($oIE), 'seconds remaining')
WEnd
$Reg = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200'); Get original security setting
RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200', 'REG_DWORD', 0); Set setting to prompt for download so it isn't blocked
$oFormDL = _IEFormGetObjByName ($oIE, "dlf")
_IEFormSubmit($oFormDL)
_IEQuit($oIE)
RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200', 'REG_DWORD', $Reg); Set original security setting back
Link to comment
Share on other sites

well here is some... "WORKS ON MY MACHINE" code :mellow:

It should at least give you a good start.

#include <IE.au3>
_IEErrorHandlerRegister ()
$URL = 'http://rapidshare.com/files/66065174/040_-_Steely_Dan_-_Reelin__In_The_Years.mp3'
$oIE = _IECreate($URL, 0, 0)
$oForm = _IEFormGetObjByName ($oIE, "ff")
_IEFormSubmit($oForm)
$Wait = StringInStr(_IEBodyReadText($oIE), 'seconds remaining')
While $Wait <> 0
    ConsoleWrite(StringStripWS(StringMid(_IEBodyReadText($oIE), $Wait - 3, 2), 8) & @CRLF)
    Sleep(1000)
    $Wait = StringInStr(_IEBodyReadText($oIE), 'seconds remaining')
WEnd
$Reg = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200'); Get original security setting
RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200', 'REG_DWORD', 0); Set setting to prompt for download so it isn't blocked
$oFormDL = _IEFormGetObjByName ($oIE, "dlf")
_IEFormSubmit($oFormDL)
_IEQuit($oIE)
RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3', '2200', 'REG_DWORD', $Reg); Set original security setting back

your method seems to be exactly what i need. the only problem is that i dont know how to implement inetget() to download the file. Do i even need to? or will it download the file by submitting the form?
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...