Skip to content

Commit 494b00c

Browse files
committed
use headless
1 parent ae2bf89 commit 494b00c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Dockerfile.backend

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ RUN go mod download
1010
RUN cd /backendBuild/backend-server/ && \
1111
go build -o backend_cmd -ldflags="-s -w " main.go
1212

13-
FROM alpine:latest
14-
#FROM docker.io/chromedp/headless-shell:latest
15-
#RUN apt-get update; apt install dumb-init -y; apt install ca-certificates -y
16-
#ENTRYPOINT ["dumb-init", "--"]
13+
#FROM alpine:latest
14+
FROM docker.io/chromedp/headless-shell:latest
15+
RUN apt-get update; apt install dumb-init -y; apt install ca-certificates -y
16+
ENTRYPOINT ["dumb-init", "--"]
1717

1818
COPY --from=build /backendBuild/backend-server/backend_cmd /usr/bin/backend_cmd
1919

backend-server/crawler/bskyapi/client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ func Fetch(websiteURL string) *model.Entry {
6161

6262
func generateEntry(resp *Response) *model.Entry {
6363
entry := new(model.Entry)
64-
entry.FullContent = "<p>" + resp.Thread.Post.Record.Text + "</p>"
64+
65+
entry.FullContent = "<p>" + strings.ReplaceAll(resp.Thread.Post.Record.Text, "\n", "<br>") + "</p>"
6566
if resp.Thread.Post.Embed.EmbedType == "app.bsky.embed.images#view" {
6667
for _, image := range resp.Thread.Post.Embed.EmbedImages {
6768
entry.FullContent = entry.FullContent + "<img src='" + image.Thumb + "' /><br>"

backend-server/crawler/threads/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func ThreadsByheadless(websiteURL string) string {
4343
//ctx, cancel := chromedp.NewContext(context.Background())
4444
defer cancelCtx()
4545
htmlContent := ""
46-
common.Logger.Info("notion headless fetch 1 ")
46+
common.Logger.Info("threads headless fetch 1 ")
4747
err := chromedp.Run(allocCtx,
4848
chromedp.Navigate(websiteURL),
4949
chromedp.WaitVisible(`[data-pressable-container=true]`, chromedp.ByQuery),

0 commit comments

Comments
 (0)