https://github.com/jetthoughts/broolik-crystal
Affiliate Links Checker for Crystal
https://github.com/jetthoughts/broolik-crystal
Last synced: about 1 year ago
JSON representation
Affiliate Links Checker for Crystal
- Host: GitHub
- URL: https://github.com/jetthoughts/broolik-crystal
- Owner: jetthoughts
- License: mit
- Created: 2019-05-29T15:48:48.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-17T15:58:24.000Z (over 6 years ago)
- Last Synced: 2025-04-13T14:04:13.578Z (about 1 year ago)
- Language: Crystal
- Homepage: https://broolik.ml
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://circleci.com/gh/jetthoughts/broolik-crystal/tree/master)
[](https://travis-ci.org/jetthoughts/broolik-crystal)
# Broolik: Affiliate Links Checker for Crystal
TODO: Write a description here
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
broolik:
github: jetthoughts/broolik-crystal
```
2. Run `shards install`
## Usage
1. Single link real-time verification:
```crystal
require "broolik"
client = Broolik.client
link = client.create_link({
"url" => "http://jetthoughts.com",
"device" => "iphone",
"country" => "UKR"
})
puts "Link validation status is: #{link.status}"
link.redirects.each do |redirect|
puts "Following '#{redirect.url}' got '#{redirect.status_code}'
end
client.close
```
2. Schedule bulk verification:
```crystal
require "broolik"
client = Broolik.client
batch = client.create_batch(
{
"url" => "http://jetthoughts.com",
"device" => "iphone",
"country" => "UKR"
},
{
"url" => "http://jtway.co",
"device" => "android",
"country" => "USA"
}
)
puts "Batch validation state is: #{batch.status}"
until batch.report_completed?
sleep 5 * 60 # 5 minutes
# Poll batch result each 5 minutes
batch = client.find_batch(batch.id)
puts "Batch validation state is: #{batch.status}"
end
# Show batch report content
unless batch.links_report.nil?
puts "Verification report:"
HTTP::Client.get(batch.links_report.as(String)) do |response|
puts response.body_io.gets_to_end
end
puts "=" * 10
end
client.close
```
## Development
TODO: Write development instructions here
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Paul Keen](https://github.com/pftg) - creator and maintainer