forked from KayFaraday/pleroma-ebooks
less indentified
This commit is contained in:
parent
ad707fda96
commit
e07d612e30
51
main.py
51
main.py
|
@ -179,32 +179,33 @@ for f in following:
|
||||||
try:
|
try:
|
||||||
while not done and len(j['orderedItems']) > 0:
|
while not done and len(j['orderedItems']) > 0:
|
||||||
for oi in j['orderedItems']:
|
for oi in j['orderedItems']:
|
||||||
# if (not pleroma and oi['type'] == "Create") or (pleroma and oi['to']['type'] == "Create"):
|
if oi['type'] != "Create":
|
||||||
if oi['type'] == "Create":
|
continue #not a toost. fuck outta here
|
||||||
# its a toost baby
|
|
||||||
content = oi['object']['content']
|
# its a toost baby
|
||||||
if oi['object']['summary'] != None:
|
content = oi['object']['content']
|
||||||
#don't download CW'd toots
|
if oi['object']['summary'] != None:
|
||||||
continue
|
#don't download CW'd toots
|
||||||
toot = extract_toot(content)
|
continue
|
||||||
# print(toot)
|
toot = extract_toot(content)
|
||||||
try:
|
# print(toot)
|
||||||
if pleroma:
|
try:
|
||||||
if c.execute("SELECT COUNT(*) FROM toots WHERE id LIKE ?", (oi['object']['id'],)).fetchone()[0] > 0:
|
if pleroma:
|
||||||
#we've caught up to the notices we've already downloaded, so we can stop now
|
if c.execute("SELECT COUNT(*) FROM toots WHERE id LIKE ?", (oi['object']['id'],)).fetchone()[0] > 0:
|
||||||
done = True
|
#we've caught up to the notices we've already downloaded, so we can stop now
|
||||||
break
|
done = True
|
||||||
pid = re.search(r"[^\/]+$", oi['object']['id']).group(0)
|
break
|
||||||
c.execute("REPLACE INTO toots (id, userid, uri, content) VALUES (?, ?, ?, ?)",
|
pid = re.search(r"[^\/]+$", oi['object']['id']).group(0)
|
||||||
(pid,
|
c.execute("REPLACE INTO toots (id, userid, uri, content) VALUES (?, ?, ?, ?)",
|
||||||
f.id,
|
(pid,
|
||||||
oi['object']['id'],
|
f.id,
|
||||||
toot
|
oi['object']['id'],
|
||||||
)
|
toot
|
||||||
)
|
)
|
||||||
pass
|
)
|
||||||
except:
|
pass
|
||||||
pass #ignore any toots that don't go into the DB
|
except:
|
||||||
|
pass #ignore any toots that don't successfully go into the DB
|
||||||
# sys.exit(0)
|
# sys.exit(0)
|
||||||
if not pleroma:
|
if not pleroma:
|
||||||
r = requests.get(j['prev'], timeout=15)
|
r = requests.get(j['prev'], timeout=15)
|
||||||
|
|
Loading…
Reference in New Issue