Use go modules

This commit is contained in:
Pijus Kamandulis 2020-04-12 03:22:00 +03:00
parent 0a08f62dfe
commit 70c3faf17e
28 changed files with 92 additions and 68 deletions

View File

@ -10,9 +10,9 @@ import (
"github.com/chromedp/chromedp" "github.com/chromedp/chromedp"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// GetMusicUploads - Get all uploads by given music // GetMusicUploads - Get all uploads by given music

View File

@ -3,8 +3,8 @@ package client
import ( import (
"fmt" "fmt"
models "../models" models "github.com/pikami/tiktok-dl/models"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
) )
// GetHashtagUploads - Get all uploads marked with given hashtag // GetHashtagUploads - Get all uploads marked with given hashtag

View File

@ -3,8 +3,8 @@ package client
import ( import (
"fmt" "fmt"
models "../models" models "github.com/pikami/tiktok-dl/models"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
) )
// GetMusicUploads - Get all uploads by given music // GetMusicUploads - Get all uploads by given music

View File

@ -8,8 +8,8 @@ import (
"github.com/chromedp/chromedp" "github.com/chromedp/chromedp"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// GetRedirectURL - Returns URL that the given URL redirects to // GetRedirectURL - Returns URL that the given URL redirects to

View File

@ -3,8 +3,8 @@ package client
import ( import (
"fmt" "fmt"
models "../models" models "github.com/pikami/tiktok-dl/models"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
) )
// GetUserUploads - Get all uploads by user // GetUserUploads - Get all uploads by user

View File

@ -1,7 +1,7 @@
package client package client
import ( import (
models "../models" models "github.com/pikami/tiktok-dl/models"
) )
// GetVideoDetails - returns details of video // GetVideoDetails - returns details of video

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module github.com/pikami/tiktok-dl
go 1.14
require github.com/chromedp/chromedp v0.5.3

16
go.sum Normal file
View File

@ -0,0 +1,16 @@
github.com/chromedp/cdproto v0.0.0-20200116234248-4da64dd111ac h1:T7V5BXqnYd55Hj/g5uhDYumg9Fp3rMTS6bykYtTIFX4=
github.com/chromedp/cdproto v0.0.0-20200116234248-4da64dd111ac/go.mod h1:PfAWWKJqjlGFYJEidUM6aVIWPr0EpobeyVWEEmplX7g=
github.com/chromedp/chromedp v0.5.3 h1:F9LafxmYpsQhWQBdCs+6Sret1zzeeFyHS5LkRF//Ffg=
github.com/chromedp/chromedp v0.5.3/go.mod h1:YLdPtndaHQ4rCpSpBG+IPpy9JvX0VD+7aaLxYgYj28w=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08 h1:V0an7KRw92wmJysvFvtqtKMAPmvS5O0jtB0nYo6t+gs=
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08/go.mod h1:dFWs1zEqDjFtnBXsd1vPOZaLsESovai349994nHx3e0=
github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM=
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@ -1,8 +1,8 @@
package main package main
import ( import (
config "./models/config" config "github.com/pikami/tiktok-dl/models/config"
workflows "./workflows" workflows "github.com/pikami/tiktok-dl/workflows"
) )
func main() { func main() {

View File

@ -5,9 +5,9 @@ import (
"os" "os"
"strings" "strings"
res "../resources" res "github.com/pikami/tiktok-dl/resources"
checkErr "../utils/checkErr" checkErr "github.com/pikami/tiktok-dl/utils/checkErr"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// Upload - Upload object // Upload - Upload object

View File

@ -4,8 +4,8 @@ import (
"os" "os"
"testing" "testing"
testUtil "../unitTestUtil" testUtil "github.com/pikami/tiktok-dl/unitTestUtil"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
) )
func TestParseUploads(t *testing.T) { func TestParseUploads(t *testing.T) {

View File

@ -7,7 +7,7 @@
"test": "go test -v ./models && go test -v ./utils", "test": "go test -v ./models && go test -v ./utils",
"clean": "rm -rf out", "clean": "rm -rf out",
"build:scraper": "node node_modules/terser/bin/terser -c -m -- scraper.js > out/scraper.js", "build:scraper": "node node_modules/terser/bin/terser -c -m -- scraper.js > out/scraper.js",
"build:app": "go build -o out/ -v .", "build:app": "go build -o out/tiktok-dl -v .",
"build:dist": "mkdir out && npm run build:app && npm run build:scraper", "build:dist": "mkdir out && npm run build:app && npm run build:scraper",
"build": "go build -v .", "build": "go build -v .",
"sonar": "sonar-scanner -Dsonar.login=${SONAR_LOGIN} -Dproject.settings=.sonar/sonar-project.properties" "sonar": "sonar-scanner -Dsonar.login=${SONAR_LOGIN} -Dproject.settings=.sonar/sonar-project.properties"

View File

@ -1,10 +1,10 @@
package utils package utils
import ( import (
models "../models" models "github.com/pikami/tiktok-dl/models"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
fileio "./fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "./log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// IsItemInArchive - Checks if the item is already archived // IsItemInArchive - Checks if the item is already archived

View File

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"os" "os"
checkErr "./checkErr" checkErr "github.com/pikami/tiktok-dl/utils/checkErr"
) )
// DownloadFile - Downloads content from `url` and stores it in `outputPath` // DownloadFile - Downloads content from `url` and stores it in `outputPath`

View File

@ -5,7 +5,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
checkErr "../checkErr" checkErr "github.com/pikami/tiktok-dl/utils/checkErr"
) )
type delegateString func(string) type delegateString func(string)

View File

@ -1,9 +1,10 @@
package utils package utils
import ( import (
res "../resources"
"fmt" "fmt"
"strings" "strings"
res "github.com/pikami/tiktok-dl/resources"
) )
// GetHashtagFromURL - Get's tag name from passed url // GetHashtagFromURL - Get's tag name from passed url

View File

@ -1,11 +1,12 @@
package utils package utils
import ( import (
config "../models/config"
res "../resources"
"fmt" "fmt"
"regexp" "regexp"
"strings" "strings"
config "github.com/pikami/tiktok-dl/models/config"
res "github.com/pikami/tiktok-dl/resources"
) )
// GetUsername - Get's username from passed URL param // GetUsername - Get's username from passed URL param

View File

@ -1,9 +1,10 @@
package utils package utils
import ( import (
config "../models/config"
testUtil "../unitTestUtil"
"testing" "testing"
config "github.com/pikami/tiktok-dl/models/config"
testUtil "github.com/pikami/tiktok-dl/unitTestUtil"
) )
func TestGetUsername(t *testing.T) { func TestGetUsername(t *testing.T) {

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
config "../../models/config" config "github.com/pikami/tiktok-dl/models/config"
) )
// Log - Write to std out // Log - Write to std out

View File

@ -3,7 +3,7 @@ package utils
import ( import (
"io/ioutil" "io/ioutil"
checkErr "./checkErr" checkErr "github.com/pikami/tiktok-dl/utils/checkErr"
) )
// ReadFileAsString - Returns contents of given file // ReadFileAsString - Returns contents of given file

View File

@ -1,13 +1,13 @@
package workflows package workflows
import ( import (
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
res "../resources" res "github.com/pikami/tiktok-dl/resources"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// OnWorkflowFail - Funtion called when workflow fails // OnWorkflowFail - Function called when workflow fails
func OnWorkflowFail(err error, workItem string) { func OnWorkflowFail(err error, workItem string) {
failLogFilePath := config.Config.FailLogFilePath failLogFilePath := config.Config.FailLogFilePath

View File

@ -1,9 +1,9 @@
package workflows package workflows
import ( import (
res "../resources" res "github.com/pikami/tiktok-dl/resources"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadBatchFile - Check's if DownloadBatchFile can be used // CanUseDownloadBatchFile - Check's if DownloadBatchFile can be used

View File

@ -4,11 +4,11 @@ import (
"fmt" "fmt"
"strings" "strings"
client "../client" client "github.com/pikami/tiktok-dl/client"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadHashtag - Test's if this workflow can be used for parameter // CanUseDownloadHashtag - Test's if this workflow can be used for parameter

View File

@ -4,11 +4,11 @@ import (
"fmt" "fmt"
"regexp" "regexp"
client "../client" client "github.com/pikami/tiktok-dl/client"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadMusic - Check's if DownloadMusic can be used for parameter // CanUseDownloadMusic - Check's if DownloadMusic can be used for parameter

View File

@ -3,8 +3,8 @@ package workflows
import ( import (
"regexp" "regexp"
client "../client" client "github.com/pikami/tiktok-dl/client"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadShareLink - Check's if DownloadShareLink can be used // CanUseDownloadShareLink - Check's if DownloadShareLink can be used

View File

@ -5,11 +5,11 @@ import (
"regexp" "regexp"
"strings" "strings"
client "../client" client "github.com/pikami/tiktok-dl/client"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadUser - Test's if this workflow can be used for parameter // CanUseDownloadUser - Test's if this workflow can be used for parameter

View File

@ -4,12 +4,12 @@ import (
"fmt" "fmt"
"regexp" "regexp"
client "../client" client "github.com/pikami/tiktok-dl/client"
models "../models" models "github.com/pikami/tiktok-dl/models"
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
fileio "../utils/fileio" fileio "github.com/pikami/tiktok-dl/utils/fileio"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// CanUseDownloadSingleVideo - Check's if DownloadSingleVideo can be used for parameter // CanUseDownloadSingleVideo - Check's if DownloadSingleVideo can be used for parameter

View File

@ -1,10 +1,10 @@
package workflows package workflows
import ( import (
config "../models/config" config "github.com/pikami/tiktok-dl/models/config"
res "../resources" res "github.com/pikami/tiktok-dl/resources"
utils "../utils" utils "github.com/pikami/tiktok-dl/utils"
log "../utils/log" log "github.com/pikami/tiktok-dl/utils/log"
) )
// StartWorkflowByParameter - Start needed workflow by given parameter // StartWorkflowByParameter - Start needed workflow by given parameter