summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authormain()2016-12-17 04:48:26 +0100
committermain()2016-12-17 04:48:26 +0100
commitc41adc06827ccf3a6af4f4f70b03f357e19714c9 (patch)
treee8fa9cc1ecba2d94f3a9c7234c2bf81ddd0b8f72
downloadaur-c41adc06827ccf3a6af4f4f70b03f357e19714c9.tar.gz
Initial commit
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD25
-rw-r--r--windows10-download.sh2
-rwxr-xr-xwindows10-get-download-link.py43
4 files changed, 88 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..5c8a605815a8
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = windows10-downloader
+ pkgdesc = Windows 10 downloader
+ pkgver = 1.0
+ pkgrel = 1
+ arch = any
+ license = GPL
+ makedepends = git
+ depends = python3
+ depends = python-yaml
+ depends = python-requests
+ depends = wget
+ source = windows10-get-download-link.py
+ source = windows10-download.sh
+ md5sums = 17301792daff69c353bd8d787d9602ee
+ md5sums = bb94ccaa16913605f40a1d877ee61d31
+
+pkgname = windows10-downloader
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..fc06463ab775
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,25 @@
+pkgname=windows10-downloader
+pkgver=1.0
+pkgrel=1
+pkgdesc="Windows 10 downloader"
+arch=('any')
+url=""
+license=('GPL')
+groups=()
+depends=('python3' 'python-yaml' 'python-requests' 'wget')
+optdepends=()
+makedepends=('git')
+provides=()
+conflicts=()
+replaces=()
+backup=()
+options=()
+install=
+source=('windows10-get-download-link.py' 'windows10-download.sh')
+noextract=()
+md5sums=('17301792daff69c353bd8d787d9602ee' 'bb94ccaa16913605f40a1d877ee61d31')
+
+package() {
+ install -D windows10-get-download-link.py $pkgdir/usr/bin/windows10-get-download-link
+ install -D windows10-download.sh $pkgdir/usr/bin/windows10-download
+}
diff --git a/windows10-download.sh b/windows10-download.sh
new file mode 100644
index 000000000000..4ff553f920c1
--- /dev/null
+++ b/windows10-download.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+wget --content-disposition "$(windows10-get-download-link)"
diff --git a/windows10-get-download-link.py b/windows10-get-download-link.py
new file mode 100755
index 000000000000..6940ec81e26e
--- /dev/null
+++ b/windows10-get-download-link.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+from __future__ import print_function
+import requests, yaml, sys
+from html.parser import HTMLParser
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+def einput(question):
+ eprint(question, end='')
+ return input()
+
+langlist = requests.get('https://www.microsoft.com/en-US/api/controls/contentinclude/html?pageId=a8f8f489-4c7f-463a-9ca6-5cff94d8d041&host=www.microsoft.com&segments=software-download%2cwindows10ISO&query=&action=getskuinformationbyproductedition&productEditionId=244&sdVersion=2').text
+
+objects = []
+class ObjectParser(HTMLParser):
+ def handle_starttag(self, tag, attrs):
+ if tag in ['option', 'input']:
+ for k, v in attrs:
+ if k == 'value' and v:
+ objects.append(yaml.load(v))
+
+parser = ObjectParser()
+parser.feed(langlist)
+
+eprint('Available languages:')
+for i, lang in enumerate(objects):
+ eprint(' [{}] {}'.format(i, lang['language']))
+
+choice = objects[int(einput('Your choice: '))]
+objects = []
+
+
+links = requests.get('https://www.microsoft.com/en-US/api/controls/contentinclude/html?pageId=cfa9e580-a81e-4a4b-a846-7b21bf4e2e5b&host=www.microsoft.com&segments=software-download%2cwindows10ISO&query=&action=GetProductDownloadLinksBySku&skuId={id}&language=dummy&sdVersion=2'.format(**choice)).text
+parser.feed(links)
+
+eprint()
+eprint('Available downloads:')
+for i, download in enumerate(objects):
+ eprint(' [{}] {} ({})'.format(i, download['Name'], download['DownloadType'][3:]))
+choice = objects[int(einput('Your choice: '))]
+
+eprint()
+print(choice['Uri'])