add fb and css/js scripts

master
Paul Walko 2016-12-26 23:43:39 -05:00
parent 76a481420c
commit 34a2b1132c
3 changed files with 64 additions and 1 deletions

46
fb.py Executable file
View File

@ -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)

View File

@ -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

17
loadCSSJS.js Normal file
View File

@ -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);
}