-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 660503d Author: azimut <azimut.github@protonmail.com> Date: Thu Apr 20 02:56:25 2023 -0300 fix: parse multi reply with same message for all commit 0c290f9 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 23:51:45 2023 -0300 goreleaser add fourchan commit 174597f Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 23:38:38 2023 -0300 minor TODO commit 4e9dcc2 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 22:55:07 2023 -0300 fix: range bug on .find() for nested replies commit 3356a8c Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 20:57:39 2023 -0300 minor always print filename commit 427d7a6 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 20:28:37 2023 -0300 minor: formatting, add go-4chan-api bug description commit e299e9e Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 12:47:23 2023 -0300 added wrapping of comments and greentext commit c952509 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 11:00:49 2023 -0300 fix send clean unique comment, test cleanComment() commit 26c709d Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 09:26:18 2023 -0300 minor: clean comments of <br> on the sides and all of <wbr> commit 7dca443 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 08:21:23 2023 -0300 fix: add support for empty reply messages commit 70c36d4 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 06:56:26 2023 -0300 test: add id's to test, for easier conditional breakpoints commit 143076e Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 06:35:37 2023 -0300 tests: add specific tests explodePost commit fc8b36d Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 04:15:35 2023 -0300 minor: fix printing format of comments commit 2015f60 Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 03:53:48 2023 -0300 reQuote extend to optionally capture " <br>" at the end commit 1a8b22a Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 03:19:41 2023 -0300 fixed not nestings issue, add DEBUG on makefile to disable -ldflags apparently kind of obvious, but not evident when looking at the code (? but when you have do a for-range loop your elements are NOT pointers they are copies for _, post := range thread.posts // post is Post not *Post so if you use that *post* reference it will be lost on the stack instead, directly index for i := range thread.posts and use thread.posts[i] commit d099c1e Author: azimut <azimut.github@protonmail.com> Date: Wed Apr 19 00:40:16 2023 -0300 debugging post.replies insertion commit 8b23614 Author: azimut <azimut.github@protonmail.com> Date: Tue Apr 18 11:28:30 2023 -0300 fix makefile + .gitignore bins + fourchan graph mostly complete missing add depth field and other formatting of messages commit b3c1058 Author: azimut <azimut.github@protonmail.com> Date: Fri Apr 14 20:08:39 2023 -0300 update todos... add codeblock and embed commit abf0841 Author: azimut <azimut.github@protonmail.com> Date: Fri Apr 14 04:24:20 2023 -0300 update todo... commit 663d711 Author: azimut <azimut.github@protonmail.com> Date: Thu Apr 13 02:33:08 2023 -0300 add TODO notes commit 7d3608b Author: azimut <azimut.github@protonmail.com> Date: Thu Apr 13 02:32:33 2023 -0300 fix: skip post 0 from go-4chan-api, minor rename commit bdb3bdd Author: azimut <azimut.github@protonmail.com> Date: Thu Apr 13 00:30:01 2023 -0300 initial 4chan parsing and structs needs more parsing for - comment tree generation - and html parsing - absolute links fixing - relative links fixing - for external messages (not in the thread) - for internal messages (in the thread) - probably only use them for the tree generation
- Loading branch information
Showing
16 changed files
with
949 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
GO_FILES = $(shell find . -type f -name '*.go') | ||
GO_FILES := $(shell find . -type f -name '*.go') | ||
BINARIES := twitterview hackerview redditview fourchanview | ||
LDFLAGS := -ldflags="-s -w" | ||
|
||
ifdef DEBUG | ||
undefine LDFLAGS | ||
endif | ||
|
||
.PHONY: all install clean test | ||
|
||
all: twitterview hackerview redditview | ||
all: $(BINARIES) | ||
|
||
hackerview: | ||
redditview: | ||
twitterview: $(GO_FILES) | ||
go build -v -ldflags="-s -w" ./cmd/$@ | ||
$(BINARIES): $(GO_FILES) | ||
go build -v $(LDFLAGS) ./cmd/$@ | ||
ls -lh $@ | ||
|
||
install: hackerview twitterview redditview | ||
mv hackerview $(HOME)/go/bin/ | ||
mv twitterview $(HOME)/go/bin/ | ||
mv redditview $(HOME)/go/bin/ | ||
install: $(BINARIES); | ||
mv $(BINARIES) $(HOME)/go/bin/ | ||
|
||
clean: ; go clean -x ./... | ||
test: ; go test -vet=all -v -race ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"flag" | ||
"fmt" | ||
"io" | ||
"log" | ||
"os" | ||
"time" | ||
|
||
"github.com/azimut/cli-view/internal/fourchan" | ||
"github.com/fatih/color" | ||
) | ||
|
||
type options struct { | ||
timeout time.Duration | ||
useColors bool | ||
userAgent string | ||
width int | ||
} | ||
|
||
var opts options | ||
|
||
func init() { | ||
flag.BoolVar(&opts.useColors, "C", true, "use colors") | ||
flag.IntVar(&opts.width, "w", 80, "fixed with") // TODO: use opts.width | ||
} | ||
|
||
func usage() { | ||
fmt.Printf("Usage: %s [OPTIONS] URL ...\n", os.Args[0]) | ||
flag.PrintDefaults() | ||
} | ||
|
||
func run(args []string, stdout io.Writer) error { | ||
flag.Parse() | ||
flag.Usage = usage | ||
color.NoColor = !opts.useColors | ||
if flag.NArg() != 1 { | ||
flag.Usage() | ||
return errors.New("missing URL argument") | ||
} | ||
url := flag.Args()[0] | ||
thread, err := fourchan.Fetch(url) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println(thread) | ||
return nil | ||
} | ||
|
||
func main() { | ||
err := run(os.Args, os.Stdout) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
- TUI: Add link to comment. So people can CAPTCHA and reply there. | ||
- go-4chan-api bug: parsing this json post, will return a Post with an *nil* File | ||
#+begin_src json | ||
{ | ||
"com": "sveltecomrades...", | ||
"ext": ".png", | ||
"filename": "", | ||
"fsize": 771586, | ||
"h": 1486, | ||
"md5": "yABXo4At8BsykjrRXWe3BA==", | ||
"name": "Anonymous", | ||
"no": 92882383, | ||
"now": "04/18/23(Tue)20:14:20", | ||
"resto": 92881288, | ||
"tim": 1681863260820065, | ||
"time": 1681863260, | ||
"tn_h": 79, | ||
"tn_w": 125, | ||
"w": 2346, | ||
} | ||
#+end_src | ||
- Types of messages | ||
- [ ] Mentioning another post in the middle of the respons | ||
#+begin_src html | ||
<a href="#p92877538" class="quotelink">>>92877538</a><br> | ||
<span class="quote">>Multi-threaded GREP implementation.</span><br> | ||
how would that work?<br> | ||
<span class="quote">>Language virtual machine</span><br> | ||
what does that mean?<br> | ||
<span class="quote">>Daemonized calculator</span><br> | ||
cringe<br> | ||
<span class="quote">>General Lambert's-Problem Solver</span><br> | ||
cringe, see <a href="#p92892503" class="quotelink">>>92892503</a> and stop sucking dicks | ||
#+end_src | ||
#+begin_src html | ||
<a href="#p92877538" class="quotelink">>>92877538</a><br><span class="quote">>Multi-threaded GREP implementation.</span><br>how would that work?<br><span class="quote">>Language virtual machine</span><br>what does that mean?<br><span class="quote">>Daemonized calculator</span><br>cringe<br><span class="quote">>General Lambert's-Problem Solver</span><br>cringe, see <a href="#p92892503" class="quotelink">>>92892503</a> and stop sucking dicks | ||
#+end_src | ||
#+begin_src | ||
>>92877538 | ||
>Multi-threaded GREP implementation. | ||
how would that work? | ||
>Language virtual machine | ||
what does that mean? | ||
>Daemonized calculator | ||
cringe | ||
>General Lambert's-Problem Solver | ||
cringe, see >>92892503 and stop sucking dicks | ||
#+end_src | ||
- [ ] Code embed *<pre class=prettyprint"*, could be inlined | ||
#+begin_src html | ||
<a href=\"#p92788773\" class=\"quotelink\">>>92788773</a><br> | ||
<span class=\"quote\">>In the first one, you're passing i a dictionary that matches the keyword arguments of the function, so it works.</span><br> | ||
I see, thank you anon.<br> | ||
But....aren't function arguments when declaring it just random words that do not need to fit the names of the variables/objects that will use it?<br> | ||
Like, this works:<br> | ||
<br> | ||
<pre class=\"prettyprint\">a='hello world'<br> | ||
<br> | ||
def fun(qqq):<br> | ||
print(qqq)<br> | ||
<br> | ||
fun(a)<br> | ||
</pre><br> | ||
<br> | ||
It did not matter if i write the argument of the function <pre class=\"prettyprint\">def fun(lollmao)</pre>, it can take any variable in it even if it's not called "lollmao", how come now the args need to fit 100% the name of the keys in the dictionary unpacked? | ||
#+end_src | ||
#+begin_src | ||
>>92788773 | ||
>In the first one, you're passing i a dictionary that matches the keyword arguments of the function, so it works. | ||
I see, thank you anon. | ||
But....aren't function arguments when declaring it just random words that do not need to fit the names of the variables/objects that will use it? | ||
Like, this works: | ||
|
||
a='hello world' | ||
|
||
def fun(qqq): | ||
print(qqq) | ||
|
||
fun(a) | ||
|
||
|
||
|
||
It did not matter if i write the argument of the function | ||
|
||
def fun(lollmao) | ||
|
||
, it can take any variable in it even if it's not called "lollmao", how come now the args need to fit 100% the name of the keys in the dictionary unpacked? | ||
#+end_src | ||
- [ ] YT Embed (I ADDED NEW LINE AFTER BR) | ||
#+begin_src html | ||
<a href=\"#p92787439\" class=\"quotelink\">>>92787439</a><br> | ||
<span class=\"quote\">>I like watching Unix history videos</span><br> | ||
here's a good one<br> | ||
https://www.youtube.com/watch?v=tc4<wbr>ROCJYbm0 | ||
#+end_src | ||
#+begin_src | ||
>>92787439 | ||
>I like watching Unix history videos | ||
here's a good one | ||
https://www.youtube.com/watch?v=tc4ROCJYbm0 [Embed] | ||
#+end_src | ||
- [X] > Green text (missing <br>?) | ||
<span class="quote">>move over im gonna make the thread</span> | ||
- [ ] Link to Message on the same Thread | ||
>>92748359 | ||
<a href="#p92748359" class="quotelink">>>92748359</a><br> | ||
- [ ] Multi-quote on the same Thread, with the same message (I ADDED THE NEW LINES AFTER br) | ||
#+begin_src html | ||
<a href=\"#p92772863\" class=\"quotelink\">>>92772863</a><br> | ||
<a href=\"#p92773151\" class=\"quotelink\">>>92773151</a><br> | ||
<a href=\"#p92773243\" class=\"quotelink\">>>92773243</a><br> | ||
<a href=\"#p92773269\" class=\"quotelink\">>>92773269</a><br> | ||
<a href=\"#p92773469\" class=\"quotelink\">>>92773469</a><br> | ||
is it true about gcc?<br> | ||
https://www.youtube.com/watch?v=B5Y<wbr>okNW7tIs | ||
#+end_src | ||
- [ ] Multi-quote to messages on other Thread (I ADDED THE NEW LINES AFTER br) | ||
#+begin_src html | ||
<a href=\"/g/thread/92750475#p92762320\" class=\"quotelink\">>>92762320</a><br> | ||
I have a macro that typedef's up to 2 levels of pointers. If I ever need more, then I can modify the macro and everything will now have the extra typedefs applied. (pic related)<br> | ||
<a href=\"/g/thread/92750475#p92762569\" class=\"quotelink\">>>92762569</a><br> | ||
Nope. Never used them, never seen them used. Just return NULL if the input size is 0.<br> | ||
<a href=\"/g/thread/92750475#p92764145\" class=\"quotelink\">>>92764145</a><br> | ||
based. more people should read it. lots of pajeet code in there, but the kernel and low level code is great.<br> | ||
<a href=\"/g/thread/92750475#p92764193\" class=\"quotelink\">>>92764193</a><br> | ||
GetTempPath/GetTempFileName/CreateF<wbr>ile<br> | ||
<a href=\"/g/thread/92750475#p92764359\" class=\"quotelink\">>>92764359</a><br> | ||
<a href=\"/g/thread/92750475#p92764402\" class=\"quotelink\">>>92764402</a><br> | ||
<span class=\"quote\">>and then delete said file after youre done with it</span><br> | ||
Pass FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE to CreateFile in the dwFlagsAndAttributes parameter. Easy.<br> | ||
<a href=\"/g/thread/92750475#p92764413\" class=\"quotelink\">>>92764413</a><br> | ||
Shits unreadable bro. Stop cramming so much shit into each statement and add some fucking comments.<br> | ||
<span class=\"quote\">>The file is just a single heap allocated block of memory</span><br> | ||
You can use a file mapping to "load" a file into memory without having to do a heap allocation. CreateFile/CreateFileMapping/MapVie<wbr>wOfFile and boom you have the contents of the file in memory. It's efficient and uses less physical memory than heap allocation.<br> | ||
<a href=\"/g/thread/92750475#p92766628\" class=\"quotelink\">>>92766628</a><br> | ||
The code changes to use a table if you have 100 shapes. The best solution for any problem depends on the problem, and doing shit to calculate 3 kinds of shapes isn't even remotely the same as for 30 kinds of shapes.<br> | ||
<a href=\"/g/thread/92750475#p92766776\" class=\"quotelink\">>>92766776</a><br> | ||
linux config files are a disaster anyway, no harm in inventing one more format to throw on the pile. kek.<br> | ||
<a href=\"/g/thread/92750475#p92768358\" class=\"quotelink\">>>92768358</a><br> | ||
<span class=\"quote\">>rumours about the NT kernal</span><br> | ||
read the source. download the WRK from github. that code used to run on every PC in existence. | ||
#+end_src | ||
- [ ] Multi-quote messages are separate by 2 <br><br> | ||
- [ ] Link to Message on another Thread | ||
>>92748198 → | ||
<a href="/g/thread/92745370#p92748198" class="quotelink">>>92748198</a><br> | ||
- [ ] Normal text is urlencoded | ||
Made me smile, Thank G'yoo | ||
Made me smile, Thank G'yoo | ||
- [ ] Normal text might have a random *<wbr>* | ||
- [ ] Normal text has *<br>* for new lines | ||
Hi guys got a question | ||
I'm using Automatic 1111 | ||
how do I increase the generation batch count? | ||
I want to let it run overnight but I'm capped at 100 and I burn that in like two hours | ||
Hi guys got a question<br>I'm using Automatic 1111<br>how do I increase the generation batch count?<br>I want to let it run overnight but I'm capped at 100 and I burn that in like two hours |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package fourchan | ||
|
||
import ( | ||
"github.com/moshee/go-4chan-api/api" | ||
) | ||
|
||
func Fetch(rawUrl string) (*Thread, error) { | ||
threadId, board, err := parseUrl(rawUrl) | ||
if err != nil { | ||
return nil, err | ||
} | ||
apiThread, err := api.GetThread(board, int64(threadId)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
thread := toThread(apiThread) | ||
return thread, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package fourchan | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
const URL = `https://boards.4channel.org/g/thread/92748329/sdg-stable-diffusion-general` | ||
|
||
func TestFormatThread(t *testing.T) { | ||
thread, err := Fetch(URL) | ||
if err != nil { | ||
t.FailNow() | ||
} | ||
fmt.Println(thread) | ||
} |
Oops, something went wrong.