Last active
October 5, 2018 03:56
-
-
Save jack980517/5730952ed1a4dd36ecbba12aadc7e9ea to your computer and use it in GitHub Desktop.
Get offline installers of Flash Player plugins for all available platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json,urllib,sys,os,glob | |
from distutils.version import LooseVersion as lv | |
dl=urllib.urlretrieve | |
api_url='https://get.adobe.com/flashplayer/webservices/json/?platform_type=%s&platform_dist=%s&platform_arch=%s&platform_misc=&exclude_version=&browser_arch=&browser_type=&browser_vers=&browser_dist=&eventname=flashplayerotherversions' | |
configs={ | |
'win8':('Windows','Windows%208',''), # Windows 10/Windows 8 | |
'winxp':('Windows','XP','x86-32'), # Windows 7/Vista/XP | |
'mac':('Macintosh','','x86-64'), # Mac OS X 10.6 - 10.13 | |
'linux64':('Linux','','x86-64'), # Linux (64-bit) | |
'linux32':('Linux','','x86-32'), # Linux (32-bit) | |
} | |
if len(sys.argv)==1: mylist=configs | |
else: mylist=sys.argv[1:] | |
info=json.loads(open('info.txt').read()) if os.path.exists('info.txt') else {} | |
for platform in mylist: | |
api_return=json.loads(urllib.urlopen(api_url%configs[platform]).read()) | |
newversion=api_return[0]['Version'] | |
if platform in info.keys() and lv(info[platform])>lv(newversion): continue | |
if not os.path.exists(platform): os.mkdir(platform) | |
for f in glob.glob(platform+'/*'): os.remove(f) | |
for i in api_return: | |
print 'Downloading',i['Name'],'on',platform | |
if i['download_url'].startswith('apt'): | |
package_names=['adobe-flash-properties-gtk','adobe-flash-properties-kde','adobe-flashplugin'] | |
distro_arch_series=json.loads(urllib.urlopen('https://api.launchpad.net/1.0/ubuntu').read())['current_series_link']+'/amd64' | |
version_on_ubuntu=json.loads(urllib.urlopen('https://api.launchpad.net/1.0/ubuntu/+archive/partner?binary_name=%22adobe-flashplugin%22&distro_arch_series=%22'+urllib.quote(distro_arch_series)+'%22&ws.op=getPublishedBinaries').read())['entries'][0]['binary_package_version'][2:] | |
arch={'linux64':'amd64','linux32':'i386'}[platform] | |
ubuntu_base_url='http://archive.canonical.com/ubuntu/pool/partner/a/adobe-flashplugin/' | |
for package_name in package_names: | |
filename='%s_%s_%s.deb'%(package_name,version_on_ubuntu,arch) | |
dl(ubuntu_base_url+filename,platform+'/'+filename) | |
else: dl(i['download_url'],platform+'/'+i['download_url'].split('/')[-1]) | |
info[platform]=newversion | |
open('info.txt','w').write(json.dumps(info)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment