Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You can now specify what URLs you want to download in a file #541

Merged
merged 8 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions extractors/pornhub/pornhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ func TestPornhub(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
data, err := Extract(tt.args.URL)
test.CheckError(t, err)
test.Check(t, tt.args, data[0])
Extract(tt.args.URL)
})
}
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func main() {
file, err := os.Open(config.File)
if err != nil {
fmt.Printf("Error %v", err)
return
}
defer file.Close()

Expand Down
3 changes: 0 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ func ParseInputFile(r io.Reader) []string {
for scanner.Scan() {
totalLines++
universalURL := strings.TrimSpace(scanner.Text())
if universalURL == "" {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you remove this, there might be empty strings in temp

Copy link
Contributor Author

@Stegosawr Stegosawr Oct 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I know. But now that you can choose what urls you want, so this shouldn't be a problem. Also if I think about a file filled with url there shouldn't be any empty lines anyway?

continue
}
temp = append(temp, universalURL)
}

Expand Down
16 changes: 6 additions & 10 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,8 @@ func TestLineCount(t *testing.T) {
})
}
}
func TestParsingFile(t *testing.T) {
/*_, thisFileName, _, ok := runtime.Caller(1)
if !ok {
t.Errorf("Couldn't get the path of this file")
}
fmt.Println(thisFileName)*/

func TestParsingFile(t *testing.T) {
type args struct {
filePath string
}
Expand Down Expand Up @@ -619,7 +614,7 @@ func TestParsingFile(t *testing.T) {
})
}

//test for start from x
// test for start from x
t.Run("start from x", func(t *testing.T) {
config.ItemStart = 5
config.ItemEnd = 0
Expand All @@ -633,9 +628,10 @@ func TestParsingFile(t *testing.T) {
got := ParseInputFile(file)
defer file.Close()

//start from line x to the end of the file
if len(got) != linesCount-config.ItemStart+1 {
t.Errorf("Got: %v - want: %v", len(got), linesCount-config.ItemStart+1)
// start from line x to the end of the file
// remember that the slices begin with 0 thats why it finds one line less
if len(got) != linesCount-config.ItemStart {
t.Errorf("Got: %v - want: %v", len(got), linesCount-config.ItemStart)
}
})
}