Compare commits

...

4 commits

Author SHA1 Message Date
Nora Goodman a554893b3b Remove link to blog (for now) 2025-05-27 16:24:31 -04:00
Nora Goodman f170d2ca90 Fix some directory issues 2025-05-27 16:21:15 -04:00
Nora Goodman 82611c358f Update list of links 2025-05-27 16:11:56 -04:00
Nora Goodman d94e3a0c99 Include scraper.py 2025-05-26 18:36:11 -04:00
5 changed files with 32 additions and 9 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ scraper/**
.venv/ .venv/
__pycache__/ __pycache__/
static/ static/
posts/

View file

@ -5,6 +5,7 @@ import re
from pytz import timezone from pytz import timezone
from datetime import datetime from datetime import datetime
import bisect import bisect
import shutil
from jinja2 import Environment, PackageLoader, select_autoescape from jinja2 import Environment, PackageLoader, select_autoescape
scraper_path = 'scraper/' scraper_path = 'scraper/'
@ -60,13 +61,16 @@ for folder in os.listdir(scraper_path):
post['caption'] = file.read() post['caption'] = file.read()
if ('timestamp' in post.keys()): 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)) output_file.write(post_template.render(post=post))
homepage_template = env.get_template("index.html") 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()) 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)) 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
View 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...")

View file

@ -12,16 +12,16 @@ Solidarity not charity: From Rochester, New York.
<div id="resources-box" class="fancy-border"> <div id="resources-box" class="fancy-border">
<h2>Quick resources</h2> <h2>Quick resources</h2>
<ul id="resources-list"> <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 <li><a href="https://docs.google.com/document/d/1UcoQ984Qwq22aR8YgyVk76VepxxFZM1QNllVeaHzWIs/edit?tab=t.0">List
of free food stands</a></li> of free food stands</a></li>
<li><a <li><a
href="https://www.google.com/maps/d/u/0/viewer?ll=43.19335689697014%2C-77.66649769973144&z=12&mid=1hGQ70VxoHncH6ardfHs6uh3HcrCp7iI">Map 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> 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>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>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> </ul>
</div> </div>
@ -49,5 +49,5 @@ Solidarity not charity: From Rochester, New York.
</p> </p>
</div> </div>
</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 %} {% endblock %}