aboutsummaryrefslogtreecommitdiffstats
path: root/provision.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2020-08-23 22:18:06 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2020-08-23 22:18:06 +0100
commit0740f143a22555183d41a4ff78b4958a95a12944 (patch)
tree9eab9536e4f1214c1b8e659c67237c49834fbf7b /provision.py
parent5bfdbe9b3af2c70d459378ee237542997bab1da0 (diff)
downloadyaoi-communism-0740f143a22555183d41a4ff78b4958a95a12944.tar.gz
yaoi-communism-0740f143a22555183d41a4ff78b4958a95a12944.zip
added functions to get images
Diffstat (limited to 'provision.py')
-rw-r--r--provision.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/provision.py b/provision.py
deleted file mode 100644
index 6c97a3c..0000000
--- a/provision.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import pandas
-import os
-import ast
-import twint
-import requests
-
-
-def download(url):
- filename = url.split("/")[-1]
- r = requests.get(url, allow_redirects=True)
- with open("pics/" + filename, "wb") as f:
- f.write(r.content)
-
-
-# archive @AceYuriBot for images/sources
-
-c = twint.Config()
-c.Username = "AceYuriBot"
-c.Images = True
-c.Store_csv = True
-c.Output = "yuribot.csv"
-twint.run.Search(c)
-
-os.makedirs("pics", exist_ok=True)
-df = pandas.read_csv("yuribot.csv")
-source = (
- df["urls"].apply(lambda x: ast.literal_eval(x)).apply(lambda x: x[0] if x else None)
-)
-file_location = df["photos"].apply(lambda x: os.path.basename(ast.literal_eval(x)[0]))
-# save to file where bot will pull data from
-pandas.concat([source, file_location], axis=1).to_csv("files.csv")
-# download images
-df["photos"].apply(lambda x: download(ast.literal_eval(x)[0]))