Skip to content

Commit 40b1a90

Browse files
Merge pull request #3 from 01walid/master
Add Support for --targets=Filepath with pages IDs
2 parents 73f478f + 632ef3d commit 40b1a90

File tree

5 files changed

+429
-184
lines changed

5 files changed

+429
-184
lines changed

cmd/root.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var RootCmd = &cobra.Command{
1616
if err != nil {
1717
return err
1818
}
19+
1920
return performDownload()
2021
},
2122
Example: getExamples(),
@@ -29,7 +30,7 @@ func init() {
2930
// use Audisto downloader package to initiate/resume API downloads
3031
func performDownload() error {
3132
return downloader.Get(username, password, crawlID, mode, noDetails,
32-
chunkNumber, chunkSize, output, filter, noResume, order)
33+
chunkNumber, chunkSize, output, filter, noResume, order, targets)
3334
}
3435

3536
// example command usage hooked into the CLI usage text.

downloader/audistoapi.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (api *AudistoAPIClient) GetQueryParams(forTheFirstRequest bool) url.Values
165165

166166
// GetFullQueryURL returns the full url for interacting with Audisto API, INCLUDING query params
167167
func (api *AudistoAPIClient) GetFullQueryURL(forTheFirstRequest bool) string {
168-
return api.GetQueryParams(forTheFirstRequest).Encode()
168+
return fmt.Sprintf("%s?%s", api.GetURLPath(), api.GetQueryParams(forTheFirstRequest).Encode())
169169
}
170170

171171
// SetChunkSize set AudistoAPI.ChunkSize to a new size
@@ -177,6 +177,10 @@ func (api *AudistoAPIClient) SetChunkSize(size uint64) {
177177
}
178178
}
179179

180+
func (api *AudistoAPIClient) ResetChunkSize() {
181+
api.ChunkSize = DefaultChunkSize
182+
}
183+
180184
// SetNextChunkNumber set AudistoAPI.ChunkNumber to the next chunk number
181185
func (api *AudistoAPIClient) SetNextChunkNumber(number uint64) {
182186
api.ChunkNumber = number
@@ -202,6 +206,10 @@ func (api *AudistoAPIClient) SetRequestMethod(method string) error {
202206
return nil
203207
}
204208

209+
func (api *AudistoAPIClient) SetTargetPageFilter(pageID uint64) {
210+
api.Filter = fmt.Sprintf("target_page:%d", pageID)
211+
}
212+
205213
// GetRequestURL returns a validated instance of url.URL, and an error if the validation fails
206214
func (api *AudistoAPIClient) GetRequestURL() (*url.URL, error) {
207215

0 commit comments

Comments
 (0)