Skip to content

Commit

Permalink
chore: refactor parser
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Dec 19, 2022
1 parent d7e7baa commit 8a91273
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/csr/csr.go → internal/parser/csr.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package csr
package parser

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion internal/ssr/ssr.go → internal/parser/ssr.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ssr
package parser

import (
"fmt"
Expand Down
7 changes: 3 additions & 4 deletions internal/rule/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import (
"encoding/json"
"strings"

"github.com/soulteary/RSS-Can/internal/csr"
"github.com/soulteary/RSS-Can/internal/define"
"github.com/soulteary/RSS-Can/internal/ssr"
"github.com/soulteary/RSS-Can/internal/parser"
)

func ParseConfigFromJSON(str string, ruleFile string) (define.JavaScriptConfig, error) {
Expand All @@ -32,13 +31,13 @@ func ApplyDefaults(config define.JavaScriptConfig) define.JavaScriptConfig {

func GetWebsiteDataWithConfig(config define.JavaScriptConfig) (result define.BodyParsed) {
if config.Mode == "ssr" {
return ssr.GetWebsiteDataWithConfig(config)
return parser.GetWebsiteDataWithConfig(config)
}

if config.Mode == "csr" {
const container = "127.0.0.1:9222"
const proxy = ""
return csr.ParsePageByGoRod(config, container, proxy)
return parser.ParsePageByGoRod(config, container, proxy)
}

// TODO handle mix, remote ...
Expand Down

0 comments on commit 8a91273

Please sign in to comment.