Fix lint issues

This commit is contained in:
Pijus Kamandulis 2020-04-09 18:53:45 +03:00
parent bb6e924866
commit 0a08f62dfe
4 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,7 @@
# TikTok-DL # TikTok-DL
[![Go Report Card](https://goreportcard.com/badge/github.com/pikami/tiktok-dl)](https://goreportcard.com/report/github.com/pikami/tiktok-dl) [![Go Report Card](https://goreportcard.com/badge/github.com/pikami/tiktok-dl)](https://goreportcard.com/report/github.com/pikami/tiktok-dl)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/pikami/tiktok-dl/tiktok-dl_CI) [![tiktok-dl_CI](https://github.com/pikami/tiktok-dl/workflows/tiktok-dl_CI/badge.svg?branch=master)](https://github.com/pikami/tiktok-dl/actions)
A simple tiktok video downloader written in go A simple tiktok video downloader written in go
@ -30,7 +30,7 @@ In the 2nd form, download all targets listed in given `BATCH_FILE`.
* `-limit` - Sets the max count of video that will be downloaded (default infinity) * `-limit` - Sets the max count of video that will be downloaded (default infinity)
* `-metadata` - Write video metadata to a .json file * `-metadata` - Write video metadata to a .json file
* `-output some_directory` - Output path (default "./downloads") * `-output some_directory` - Output path (default "./downloads")
* `-quiet` - Supress output * `-quiet` - Suppress output
## Build instructions ## Build instructions
1. Clone this repository 1. Clone this repository

View File

@ -2,16 +2,18 @@ package client
import ( import (
"context" "context"
"github.com/chromedp/chromedp"
"io/ioutil" "io/ioutil"
"os" "os"
"time" "time"
"github.com/chromedp/chromedp"
config "../models/config" config "../models/config"
log "../utils/log" log "../utils/log"
) )
func GetRedirectUrl(url string) (string, error) { // GetRedirectURL - Returns URL that the given URL redirects to
func GetRedirectURL(url string) (string, error) {
dir, err := ioutil.TempDir("", "chromedp-example") dir, err := ioutil.TempDir("", "chromedp-example")
if err != nil { if err != nil {
return "", err return "", err

View File

@ -29,7 +29,7 @@ func GetConfig() {
failLogPath := flag.String("fail-log", "", "Write failed items to log file") failLogPath := flag.String("fail-log", "", "Write failed items to log file")
debug := flag.Bool("debug", false, "Enables debug mode") debug := flag.Bool("debug", false, "Enables debug mode")
metadata := flag.Bool("metadata", false, "Write video metadata to a .json file") metadata := flag.Bool("metadata", false, "Write video metadata to a .json file")
quiet := flag.Bool("quiet", false, "Supress output") quiet := flag.Bool("quiet", false, "Suppress output")
jsonOnly := flag.Bool("json", false, "Just get JSON data from scraper (without video downloading)") jsonOnly := flag.Bool("json", false, "Just get JSON data from scraper (without video downloading)")
deadline := flag.Int("deadline", 1500, "Sets the timout for scraper logic in seconds (used as a workaround for 'context deadline exceeded' error)") deadline := flag.Int("deadline", 1500, "Sets the timout for scraper logic in seconds (used as a workaround for 'context deadline exceeded' error)")
limit := flag.Int("limit", 0, "Sets the videos count limit (useful when there too many videos from the user or by hashtag)") limit := flag.Int("limit", 0, "Sets the videos count limit (useful when there too many videos from the user or by hashtag)")

View File

@ -17,7 +17,7 @@ func CanUseDownloadShareLink(url string) bool {
func DownloadShareLink(url string) { func DownloadShareLink(url string) {
log.Logf("Resolving share link: %s\n", url) log.Logf("Resolving share link: %s\n", url)
finalURL, err := client.GetRedirectUrl(url) finalURL, err := client.GetRedirectURL(url)
if err != nil { if err != nil {
OnWorkflowFail(err, url) OnWorkflowFail(err, url)
return return