Jump to content

[SOLVED] Download the latest version of WinRar


Recommended Posts

Hey. I am trying to make a program that will download the latest WinRar from the official site. (win-rar.com) or (rarlab.com)

Tried using InetRead but it doesn't give an answer:
 

Local $sRead = InetRead("https://www.rarlab.com/download.htm", 1)
Msgbox(0,"link", $sRead)

Although the VLC site does it successfully:

Local $sRead = BinaryToString(InetRead('https://www.videolan.org/vlc/download-windows.ru.html', 1))
Msgbox(0,"link", StringRegExpReplace($sRead,'(?is).*?([^org]+\w+\.exe).*', "https://get.videolan.org$1"))

Also tried to just download:
 

InetGet("https://www.win-rar.com/postdownload.html", "C:\Users\Public\Documents\Data\winrar.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)

Nothing helps, although everything worked correctly with vlc. Please, help.

Edited by UE_morf_boon
Link to comment
Share on other sites

#include <Inet.au3>
HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")

$source = _INetGetSource("https://www.rarlab.com",1)
$pos = StringInStr($source, "English (", 0, 1)  ; use 2 for the current release version. 1 = beta version)
if $pos = 0 Then Exit MsgBox(16,"Oops", "Could not find tag in source code")
$pos = StringInStr($source, "/rar/", 0, 2, $pos) ;  use 1 for 32 Bit Version, 2 = 64 Bit
$endstring = StringInStr($source, ".exe", 0, 1, $pos)
$filename = StringMid($source, $pos+5, $endstring-$pos-1)
$url = "https://www.rarlab.com/rar/" & $filename

InetGet($url, $filename)

Not stylish, but works.

Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)

Link to comment
Share on other sites

31 minutes ago, Marc said:

Not stylish, but works.

Thank you very much! Works great!

 

UPD: Reduced to the parameters that were at the beginning, thanks again! (Example for x64 ru)
 

#include <InetConstants.au3>
HttpSetUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko")
Local $winrar_read = BinaryToString(InetRead('https://www.win-rar.com/postdownload.html?&L=4', 1))
$winrar_down_link = StringRegExpReplace($winrar_read,'(?is).*?([^versions]\w+ru.exe).*', "https://www.win-rar.com/fileadmin/winrar-versions/winrar/winrar-x64$1")
InetGet($winrar_down_link, "C:\Users\Public\Documents\winrar.exe", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)

 

Edited by UE_morf_boon
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...