From 51cb2a1f03349e0d83a2dacd94983143dc6cc034 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 09:34:05 +0200 Subject: [PATCH 01/11] sex --- files/routes/posts.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 2dc5955ad4..3dae4a94d7 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -860,8 +860,17 @@ def submit_post(v): body += "\n\n---\n\n" else: body = "" if new_post.url: - body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={quote(new_post.url)}&run=1) (click to archive)" + body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={quote(new_post.url)}&run=1) (click to archive)\n" gevent.spawn(archiveorg, new_post.url) + # archive other urls in post + url_regex = '(.+)' + for url_match in re.finditer(url_regex, new_post.body_html): + href = url_match.group(1) + title = url_match.group(2) + body += f'**[{title}]({href})**:\n\n' + body += f'* [reveddit.com](https://reveddit.com/{href})\n' + body += f'* [archive.org](https://web.archive.org/{href})\n' + body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)' body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) From a1a47218d284634294f5155fa649d61677d79577 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 09:37:13 +0200 Subject: [PATCH 02/11] sex --- files/routes/posts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 3dae4a94d7..d21440a82d 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -870,7 +870,8 @@ def submit_post(v): body += f'**[{title}]({href})**:\n\n' body += f'* [reveddit.com](https://reveddit.com/{href})\n' body += f'* [archive.org](https://web.archive.org/{href})\n' - body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)' + body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n' + gevent.spawn(archiveorg, href) body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) From 99d4138d9a12d28cdbf83d0d1eb0db278bbdb892 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 10:42:52 +0200 Subject: [PATCH 03/11] pee --- files/routes/posts.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/routes/posts.py b/files/routes/posts.py index d21440a82d..b2301796a2 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -862,16 +862,19 @@ def submit_post(v): if new_post.url: body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={quote(new_post.url)}&run=1) (click to archive)\n" gevent.spawn(archiveorg, new_post.url) + # archive other urls in post url_regex = '(.+)' for url_match in re.finditer(url_regex, new_post.body_html): href = url_match.group(1) + print(href) title = url_match.group(2) body += f'**[{title}]({href})**:\n\n' body += f'* [reveddit.com](https://reveddit.com/{href})\n' body += f'* [archive.org](https://web.archive.org/{href})\n' body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n' gevent.spawn(archiveorg, href) + body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) From 3ac1a186442d29068c5e10eb80640ee73c823384 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 10:48:16 +0200 Subject: [PATCH 04/11] jifdehr --- files/routes/posts.py | 1 + 1 file changed, 1 insertion(+) diff --git a/files/routes/posts.py b/files/routes/posts.py index b2301796a2..17a3317b82 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -865,6 +865,7 @@ def submit_post(v): # archive other urls in post url_regex = '(.+)' + print(new_post.body_html) for url_match in re.finditer(url_regex, new_post.body_html): href = url_match.group(1) print(href) From 792fd1daaba52ea23db15e27b7d4d26071f8e69f Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 10:50:40 +0200 Subject: [PATCH 05/11] hdue --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 17a3317b82..59b774ed49 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -864,7 +864,7 @@ def submit_post(v): gevent.spawn(archiveorg, new_post.url) # archive other urls in post - url_regex = '(.+)' + url_regex = '(.+)' print(new_post.body_html) for url_match in re.finditer(url_regex, new_post.body_html): href = url_match.group(1) From 8c9b8809d31939d81f01dd5054ef1c9362097294 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:03:43 +0200 Subject: [PATCH 06/11] iojd --- files/routes/posts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 59b774ed49..cc04b94164 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -864,9 +864,9 @@ def submit_post(v): gevent.spawn(archiveorg, new_post.url) # archive other urls in post - url_regex = '(.+)' + url_regex = '([^\"]+)' print(new_post.body_html) - for url_match in re.finditer(url_regex, new_post.body_html): + for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I): href = url_match.group(1) print(href) title = url_match.group(2) From 02f83e46ca4333d5278ce93edd9b885ac1c2b48f Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:15:11 +0200 Subject: [PATCH 07/11] uiuewhdiw --- files/routes/posts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index cc04b94164..dd52bd0b61 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -865,9 +865,13 @@ def submit_post(v): # archive other urls in post url_regex = '([^\"]+)' - print(new_post.body_html) - for url_match in re.finditer(url_regex, new_post.body_html, flags=re.M|re.I): + _body = new_post.body_html + for url_match in re.finditer(url_regex, _body, flags=re.M|re.I): href = url_match.group(1) + + if not href: + continue + print(href) title = url_match.group(2) body += f'**[{title}]({href})**:\n\n' From 3ac12cf03a34ad7971ad2602eed3b1b6780be8d3 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:19:29 +0200 Subject: [PATCH 08/11] iewdjhrefhurewiu --- files/routes/posts.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/routes/posts.py b/files/routes/posts.py index dd52bd0b61..aa32e2e98a 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -866,10 +866,12 @@ def submit_post(v): # archive other urls in post url_regex = '([^\"]+)' _body = new_post.body_html + print(_body) for url_match in re.finditer(url_regex, _body, flags=re.M|re.I): href = url_match.group(1) if not href: + print(f'{url_match.group(0)} skip') continue print(href) From b13cd051fad5b2d481724146acaa03327baa5805 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:25:18 +0200 Subject: [PATCH 09/11] iuwqdhzwezdzu --- files/routes/posts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index aa32e2e98a..24a8269ff5 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -860,22 +860,22 @@ def submit_post(v): body += "\n\n---\n\n" else: body = "" if new_post.url: - body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={quote(new_post.url)}&run=1) (click to archive)\n" + body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={quote(new_post.url)}&run=1) (click to archive)\n\n" gevent.spawn(archiveorg, new_post.url) # archive other urls in post - url_regex = '([^\"]+)' + url_regex = '([^\"]+)' _body = new_post.body_html print(_body) for url_match in re.finditer(url_regex, _body, flags=re.M|re.I): - href = url_match.group(1) + href = url_match.group(3) if not href: print(f'{url_match.group(0)} skip') continue print(href) - title = url_match.group(2) + title = url_match.group(5) body += f'**[{title}]({href})**:\n\n' body += f'* [reveddit.com](https://reveddit.com/{href})\n' body += f'* [archive.org](https://web.archive.org/{href})\n' From 0872305041add98c6b364875f3940944b9a2db2d Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:27:39 +0200 Subject: [PATCH 10/11] ijdudheiu --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 24a8269ff5..d1bae3bf51 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -864,7 +864,7 @@ def submit_post(v): gevent.spawn(archiveorg, new_post.url) # archive other urls in post - url_regex = '([^\"]+)' + url_regex = '([^\"]+)' _body = new_post.body_html print(_body) for url_match in re.finditer(url_regex, _body, flags=re.M|re.I): From 59234e54ff42b871b9f9f7eb3c00ee2b47322a76 Mon Sep 17 00:00:00 2001 From: fireworks88 Date: Wed, 27 Oct 2021 11:29:45 +0200 Subject: [PATCH 11/11] hdhudhefzwhreu --- files/routes/posts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index d1bae3bf51..7861f7dfc1 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -866,20 +866,20 @@ def submit_post(v): # archive other urls in post url_regex = '([^\"]+)' _body = new_post.body_html - print(_body) + #print(_body) for url_match in re.finditer(url_regex, _body, flags=re.M|re.I): href = url_match.group(3) if not href: - print(f'{url_match.group(0)} skip') + #print(f'{url_match.group(0)} skip') continue - print(href) + #print(href) title = url_match.group(5) body += f'**[{title}]({href})**:\n\n' body += f'* [reveddit.com](https://reveddit.com/{href})\n' body += f'* [archive.org](https://web.archive.org/{href})\n' - body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n' + body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n\n' gevent.spawn(archiveorg, href) body_md = CustomRenderer().render(mistletoe.Document(body))