summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorXZS2016-11-03 23:35:03 +0100
committerXZS2016-11-04 14:49:38 +0100
commit0df797114276e4f764fcaae68b6c90debbbf45c6 (patch)
tree2195e490ca87f2d320d38df99c749750a67abf34
parent4faa2f02d67b7903ecf42f5f28e92783541d7d16 (diff)
downloadaur-0df797114276e4f764fcaae68b6c90debbbf45c6.tar.gz
utilize opendesktop.org API
When trying to extract the tabular information about downloadable files on the theme page at opendesktop.org, the table apparently containing the sought information in the loaded webpage lacks any content in the HTML source code. Examining the load process with Firefox network analysis gave away an API endpoint from which this data is retrieved via JavaScript. Though not much documentation could be found about it, it obviously provides information about downloadable files in JSON format, which is much easier to parse than the HTML page intended for presentation to human eye anyway. Some tinkering found that queries can sensibly be composed of some of the provided variables. The id is particularily useful as we already have it in the URL, filtering only on active files that are actually retrievable helps, too.
-rw-r--r--PKGBUILD18
1 files changed, 9 insertions, 9 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 430bc78463f6..3b81231a7a50 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,11 +6,11 @@ pkgver=3.20.20160705
pkgrel=1
pkgdesc='Easy On The Eyes GNOME Shell, GTK2, GTK3 and Cinnamon themes'
arch=('any')
-url='https://www.opendesktop.org/p/1143475/'
+url='https://www.opendesktop.org/p/1143475'
license=('GPL3')
-makedepends=('lbxml2')
+makedepends=('jq')
optdepends=('gtk-engine-murrine: for GTK2 themes')
-source=("version::version${url#https}"
+source=("version::version://dl.opendesktop.org/api/files/index?format=json&status=active&collection_content_id=${url##*/}"
'https://dl.opendesktop.org/api/files/download/id/1468995652/Dark-Aurora.tar.gz')
sha256sums=('f5bbb7ea941d120d03237a28d07411aafc23e866b184083e37e02eda65aa3072'
'6fbdaaae2e59b5f514ca003ba2552fcb7eb5724bd278e291ed5ae2036563d6ff')
@@ -18,14 +18,14 @@ sha256sums=('f5bbb7ea941d120d03237a28d07411aafc23e866b184083e37e02eda65aa3072'
# The following is a very convoluted script because of makepkg's DLAGENTS escaping logic.
# An agent is added for the protocol "version". It is treated like http, which is done by processing
# the input url %u with sed, replacing the protocol back to http. Everything downloaded is then not
-# immediatley saved to the output file name %o, but first piped through sed, which finds the
-# gnome-shell version string in the Dark Aurora page on GNOME-Look.org.
-# This makes a file containing the version readily available to both pkgver and package so that they
-# not both have to sed out the version from the webpage themselves.
+# immediatley saved to the output file name %o, but first piped through jq, which finds the
+# gnome-shell version string in the JSON metadata received from the Dark Aurora page on
+# GNOME-Look.org. This makes a file containing the version readily available to both pkgver
+# and package so that they not both have to extract the version themselves again and again.
DLAGENTS=("version::/usr/bin/bash -c $(
printf '%s\n' "${DLAGENTS[@]}" | sed -n 's/http::\(.*\)/\1/p' \
- | sed 's/-[^ ] %o //' | sed 's/ /\\ /g' | sed 's/%u/$(echo\\ %u\\ |\\ sed\\ "s\/^version\/http\/")/'
-)\ |\ xmllint\ --html\ --xpath\ 'normalize-space(//span[@class=\"value\"][1]/text())'\ -\ 2>/dev/null\ >\ %o"
+ | sed 's/-[^ ] %o //' | sed 's/ /\\ /g' | sed 's/%u/$(echo\\ \"%u\"\\ |\\ sed\\ "s\/^version\/http\/")/'
+)\ |\ jq\ -j\ '.files."0".version'\ >\ %o"
"${DLAGENTS[@]}")
pkgver() {