forked from noraatfedora/fnb-roc-website
Compare commits
4 commits
7d01a75550
...
a554893b3b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a554893b3b | ||
|
|
f170d2ca90 | ||
|
|
82611c358f | ||
|
|
d94e3a0c99 |
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@ scraper/**
|
|||
.venv/
|
||||
__pycache__/
|
||||
static/
|
||||
posts/
|
||||
10
builder.py
10
builder.py
|
|
@ -5,6 +5,7 @@ import re
|
|||
from pytz import timezone
|
||||
from datetime import datetime
|
||||
import bisect
|
||||
import shutil
|
||||
from jinja2 import Environment, PackageLoader, select_autoescape
|
||||
|
||||
scraper_path = 'scraper/'
|
||||
|
|
@ -60,13 +61,16 @@ for folder in os.listdir(scraper_path):
|
|||
post['caption'] = file.read()
|
||||
|
||||
if ('timestamp' in post.keys()):
|
||||
with open(output_path + 'posts/' + str(post['timestamp']) +'.html', 'w+') as output_file:
|
||||
with open('posts/' + str(post['timestamp']) +'.html', 'w+') as output_file:
|
||||
output_file.write(post_template.render(post=post))
|
||||
|
||||
homepage_template = env.get_template("index.html")
|
||||
|
||||
with open(output_path + 'index.html', "w+") as output_file:
|
||||
with open(output_path + '/index.html', "w+") as output_file:
|
||||
output_file.write(homepage_template.render())
|
||||
|
||||
with open(output_path + 'blog.html', "w+") as output_file:
|
||||
with open(output_path + '/blog.html', "w+") as output_file:
|
||||
output_file.write(blog_template.render(posts=posts))
|
||||
|
||||
# copy all assets to be in the output
|
||||
shutil.copytree('assets/', 'static/', dirs_exist_ok=True)
|
||||
18
scraper/scraper.py
Normal file
18
scraper/scraper.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# wait between 1050 and 1150 seconds
|
||||
import instaloader
|
||||
from time import sleep
|
||||
from random import randint
|
||||
from os import listdir
|
||||
|
||||
L = instaloader.Instaloader()
|
||||
|
||||
L.load_session_from_file("down.loader54321")
|
||||
|
||||
profile_of_interest = instaloader.Profile.from_username(L.context, "rocfnb")
|
||||
files = listdir('.')
|
||||
for post in profile_of_interest.get_posts():
|
||||
if not post.shortcode in files :
|
||||
L.download_post(post, target=post.shortcode)
|
||||
sleep(randint(1050, 1150))
|
||||
else:
|
||||
print("Already downloaded " + post.shortcode +", skipping...")
|
||||
|
|
@ -12,16 +12,16 @@ Solidarity not charity: From Rochester, New York.
|
|||
<div id="resources-box" class="fancy-border">
|
||||
<h2>Quick resources</h2>
|
||||
<ul id="resources-list">
|
||||
<li><a href="https://docs.google.com/document/d/1UcoQ984Qwq22aR8YgyVk76VepxxFZM1QNllVeaHzWIs/edit?tab=t.0">List
|
||||
of food stands</a></li>
|
||||
<li><a href="https://docs.google.com/document/d/1UcoQ984Qwq22aR8YgyVk76VepxxFZM1QNllVeaHzWIs/edit?tab=t.0">List
|
||||
of free food stands</a></li>
|
||||
<li><a
|
||||
href="https://www.google.com/maps/d/u/0/viewer?ll=43.19335689697014%2C-77.66649769973144&z=12&mid=1hGQ70VxoHncH6ardfHs6uh3HcrCp7iI">Map
|
||||
of free food stands</a></li>
|
||||
<li>Venmo: @rocfoodnotbombs</li>
|
||||
<li><a href="https://forms.gle/P3ZNLQe43yZS2MU99">Food Stand Repair and Info Form</a></li>
|
||||
<li>Email: <a href="mailto:RocFoodNotBombs@proton.me">RocFoodNotBombs@proton.me</a></li>
|
||||
<li>Instagram: <a href="https://www.instagram.com/rocfnb/">@rocfnb</a></li>
|
||||
<li>Donate to our Venmo: @rocfoodnotbombs</li>
|
||||
<li><a href="https://rocresources.anarchyplanet.org/">Other Resources in Rochester</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
@ -49,5 +49,5 @@ Solidarity not charity: From Rochester, New York.
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<h2><a href="blog.html">See what we're up to :-)</a></h1>
|
||||
<!--<h2><a href="blog.html">See what we're up to :-)</a></h1>-->
|
||||
{% endblock %}
|
||||
Loading…
Reference in a new issue