Fix some bugs for initialization of new instance
This commit is contained in:
parent
8475353ac4
commit
72d7ea921b
|
|
@ -33,6 +33,11 @@ class YARS:
|
||||||
|
|
||||||
if proxy:
|
if proxy:
|
||||||
self.session.proxies.update({"http": proxy, "https": proxy})
|
self.session.proxies.update({"http": proxy, "https": proxy})
|
||||||
|
# this monthly cookie generated by visiting the website in a browser
|
||||||
|
# will need to figure out how to generate and update this
|
||||||
|
self.session.headers.update({
|
||||||
|
"Cookie": "loid=00000000252z4gni1x.2.1767064423377.Z0FBQUFBQnBVME5uYldSOGZmRnBLTXloRE0tdG1LNVBqLXFsOUIzb21nUS1RUHIwS0dEUHpIVTdHWFN6VkpsRlY2UlFQd2l2ZkdidF9rRW1kUnhONi1IM1QxTmNLVFYyWFlmeHAyZFJMWHU2WGlOdGVqS0JNX1lnV191Ymw0R3ZpVTd1dEgtWnJCN2Y"
|
||||||
|
})
|
||||||
def handle_search(self,url, params, after=None, before=None):
|
def handle_search(self,url, params, after=None, before=None):
|
||||||
if after:
|
if after:
|
||||||
params["after"] = after
|
params["after"] = after
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ def run():
|
||||||
for file in extra_files:
|
for file in extra_files:
|
||||||
print(f"Removing {file}")
|
print(f"Removing {file}")
|
||||||
os.remove(file)
|
os.remove(file)
|
||||||
empty_dirs = subprocess.run(["find", "/reddit/media", "-type", "d", "-empty"], capture_output=True, text=True)
|
empty_dirs = subprocess.run(["find", "/reddit/media", "-mindepth", "1", "-type", "d", "-empty"], capture_output=True, text=True)
|
||||||
empty_dirs = set(empty_dirs.stdout.splitlines())
|
empty_dirs = set(empty_dirs.stdout.splitlines())
|
||||||
print("Deleting empty directories")
|
print("Deleting empty directories")
|
||||||
for dir in empty_dirs:
|
for dir in empty_dirs:
|
||||||
|
|
@ -67,4 +67,5 @@ def run():
|
||||||
os.rmdir(dir)
|
os.rmdir(dir)
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|
||||||
run()
|
if __name__ == "__main__":
|
||||||
|
run()
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr></tr>
|
<tr></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<form method="post">
|
<form action="/admin" method="post">
|
||||||
<input name="type" type="text" value="sub" hidden>
|
<input name="type" type="text" value="sub" hidden>
|
||||||
<td>/r/<input name="name" type="text"></td>
|
<td>/r/<input name="name" type="text"></td>
|
||||||
<td><input name="score" type="text" value="100"></td>
|
<td><input name="score" type="text" value="100"></td>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue