Created
October 13, 2014 12:29
-
-
Save greevex/7ea363fa86b19227808b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Package "sds.sdk.test.start" | |
Var Queue $queue | |
Var Integer $count | |
Block start { | |
$queue.append "http://yandex.ru" | |
Foreach $queue | |
- set item $item | |
- call this.process $item | |
} | |
Block process { | |
Input $url | |
Call SDS.output.print "Processing {$url}" | |
Load $url | |
- set proxy "random" | |
- set userAgent "auto" | |
- set attempts 5 | |
- put result to $content | |
Parse:template $content | |
- set match "auto" | |
- set on_fail "skip" | |
- put result to $result | |
If $result.data.status == false | |
- call SDS.output.print "Status FAIL" | |
- set break true | |
Foreach $result.data.items | |
- set item $item | |
- call SDS.api.document.post $item | |
Foreach $result.data.links | |
- set item $link | |
- call $queue.append $link | |
Call SDS.output.print "Done!" | |
Return $result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment