Jump to content
Sign in to follow this  
flxfxp

Extract xpi download link from Firefox Addon download site?

Recommended Posts

flxfxp

Hi!

I'm very new with AutoIt, but I already noticed its a nice scripting tool with a good community. I would like to grab the latest version from my extensions by going to the firefox addon site, and looking in the source for the latest xpi download link. and I would like to put them in a file for easy downloading using wget. For example these addons:

https://addons.mozilla.org/en-US/firefox/addon/2410

https://addons.mozilla.org/en-US/firefox/addon/1320

Can anyone help me extract the xpi download links on those pages and put them in a file?

Many thanks,

Dennis

The Netherlands

Share this post


Link to post
Share on other sites
ProgAndy

I made an extended Stringregexp :) There is some additional information included.

#include <Inet.au3>
#include <Array.au3>
$source = _INetGetSource("https://addons.mozilla.org/en-US/firefox/browse/type:1/cat:5")


$XPIRegExp = '<p class="install-button platform-(.*?)">\s*?<a href="(.*\.xpi)" id="install.*?"' & _ 
            ' title=".*?" addonName="(.*?)" addonIcon=".*?" addonHash="(.*?)" onclick="'
$ret = StringRegExp($source,$XPIRegExp,3)
; returns an Array in this format:
; [0] -> Platform
; [1] -> Link to XPI
; [2] -> Addon Name
; [3] -> Hash
; if there are multiple Addons, this Structure is repeated :)
; [4] -> Platform
; [5] -> Link to XPI
; ...

_ArrayDisplay($ret)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
flxfxp

Thanks alot!!!!

This is exactly what I was looking for >_<

Regards,

Dennis

edit:

Could you maybe tell me why this is not working? I think it should :)

#include <Inet.au3>
#include <Array.au3>
$source = _INetGetSource("http://imgburn.com/index.php?act=download")

$XPIRegExp = '<a href="(.*\.exe)" target="_blank.*?"'
$ret = StringRegExp($source,$XPIRegExp,0)

_ArrayDisplay($ret)
Edited by flxfxp

Share this post


Link to post
Share on other sites
flxfxp

never mind, should user single quotations in regex.

working example:

#include <Inet.au3>
#include <Array.au3>
$source = _INetGetSource("http://imgburn.com/index.php?act=download")
$singlequote = Chr(39)
$XPIRegExp = '<a href=' & $singlequote & '(.*\.exe)' & $singlequote & ' target=' & $singlequote & '_blank.*?' & $singlequote & ''
$ret = StringRegExp($source,$XPIRegExp,3)
_ArrayDisplay($ret)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.