From 34a2b1132c3f3c8b4325775aa5a2feaf6377d664 Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Mon, 26 Dec 2016 23:43:39 -0500 Subject: [PATCH] add fb and css/js scripts --- fb.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 2 +- loadCSSJS.js | 17 +++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100755 fb.py create mode 100644 loadCSSJS.js diff --git a/fb.py b/fb.py new file mode 100755 index 0000000..89d0106 --- /dev/null +++ b/fb.py @@ -0,0 +1,46 @@ +#!/bin/python3 +""" +Downloads all pictures from a public facebook page +""" +import requests, json, os + +url = "{access_token}" + +response = requests.get(url) +jdata = response.json() + +path = "{path to store photos}" +files = os.listdir(path) + +fileName = '' +url = '' + +def download_image(fN, url): + print(fN) + f = open(fN, 'wb') + f.write(requests.get(url).content) + f.close() + +for key, val in jdata.items(): + if key == "albums": + for key1, val1 in val.items(): + if key1 == "data": + for d in val1: + for key2, val2 in d.items(): + if key2 == "photos": + for key3, val3 in val2.items(): + if key3 == "data": + for d1 in val3: + for key4, val4 in d1.items(): + """GET ID""" + if key4 == "id": + fileName = ''.join([val4, ".jpg"]) + if key4 == "images": + d2 = val4[0] + for key5, val5 in d2.items(): + if key5 == "source" and fileName not in files: + url = val5 + download_image(fileName, url) + + + diff --git a/install.sh b/install.sh index 87ab71d..ad40138 100755 --- a/install.sh +++ b/install.sh @@ -1 +1 @@ -sudo pacman -S syncthing alsa alsa-utils pulseaudio pavucontrol i3 xf86-86-video-amdgpu mesa-libgl lib32-mesa-libgl mesa-vdpau lib32-mesa-vdpau firefox openssh flashplugin +sudo pacman -S syncthing alsa-utils pulseaudio pavucontrol i3 xf86-video-amdgpu mesa-libgl lib32-mesa-libgl mesa-vdpau lib32-mesa-vdpau firefox openssh flashplugin xorg-xinit diff --git a/loadCSSJS.js b/loadCSSJS.js new file mode 100644 index 0000000..860eb23 --- /dev/null +++ b/loadCSSJS.js @@ -0,0 +1,17 @@ + function loadCSS(fileName){ + + var file = document.createElement("link"); + file.setAttribute("rel", "stylesheet"); + file.setAttribute("type", "text/css"); + file.setAttribute("href", fileNameame); + document.head.appendChild(file); + + } + + function loadJS(fileName) { + + var file = document.createElement("script"); + file.setAttribute("type", "text/javascript"); + file.setAttribute("src", fileName); + document.head.appendChild(file); + }