Compare commits
3 Commits
7ca6109f79
...
adfaaf8a24
Author | SHA1 | Date |
---|---|---|
Amber | adfaaf8a24 | |
Amber | 12fb5a558d | |
Amber | cc9bde1da9 |
|
@ -6,5 +6,10 @@
|
||||||
"mention_handling": 1,
|
"mention_handling": 1,
|
||||||
"max_thread_length": 15,
|
"max_thread_length": 15,
|
||||||
"strip_paired_punctuation": false,
|
"strip_paired_punctuation": false,
|
||||||
|
"limit_length": false,
|
||||||
|
"length_lower_limit": 5,
|
||||||
|
"length_upper_limit": 50,
|
||||||
|
"overlap_ratio_enabled": false,
|
||||||
|
"overlap_ratio": 0.7,
|
||||||
"website": "https://git.nixnet.services/amber/amber-ebooks"
|
"website": "https://git.nixnet.services/amber/amber-ebooks"
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ def make_toot(cfg):
|
||||||
pin, pout = multiprocessing.Pipe(False)
|
pin, pout = multiprocessing.Pipe(False)
|
||||||
p = multiprocessing.Process(target=make_sentence, args=[pout, cfg])
|
p = multiprocessing.Process(target=make_sentence, args=[pout, cfg])
|
||||||
p.start()
|
p.start()
|
||||||
p.join(5) # wait 5 seconds to get something
|
p.join(300) # wait 5 seconds to get something
|
||||||
if p.is_alive(): # if it's still trying to make a toot after 5 seconds
|
if p.is_alive(): # if it's still trying to make a toot after 5 seconds
|
||||||
p.terminate()
|
p.terminate()
|
||||||
p.join()
|
p.join()
|
||||||
|
@ -77,6 +77,7 @@ def make_toot(cfg):
|
||||||
|
|
||||||
|
|
||||||
def extract_toot(toot):
|
def extract_toot(toot):
|
||||||
|
toot = re.sub("<br>", "\n", toot)
|
||||||
toot = html.unescape(toot) # convert HTML escape codes to text
|
toot = html.unescape(toot) # convert HTML escape codes to text
|
||||||
soup = BeautifulSoup(toot, "html.parser")
|
soup = BeautifulSoup(toot, "html.parser")
|
||||||
for lb in soup.select("br"): # replace <br> with linebreak
|
for lb in soup.select("br"): # replace <br> with linebreak
|
||||||
|
|
4
main.py
4
main.py
|
@ -10,9 +10,7 @@ import requests
|
||||||
import functions
|
import functions
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Log in and download posts.')
|
parser = argparse.ArgumentParser(description='Log in and download posts.')
|
||||||
parser.add_argument(
|
parser.add_argument('-c', '--cfg', dest='cfg', default='config.json', nargs='?', help="Specify a custom location for config.json.")
|
||||||
'-c', '--cfg', dest='cfg', default='config.json', nargs='?',
|
|
||||||
help="Specify a custom location for config.json.")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue