curlyq 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +10 -9
- data/README.md +2 -2
- data/bin/curlyq +2 -8
- data/lib/curly/curl/html.rb +3 -2
- data/lib/curly/string.rb +18 -0
- data/lib/curly/version.rb +1 -1
- data/src/_README.md +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38b735c7b0ead432ad659482e59c4e9385e82fc71063eedda37440dac537e211
|
4
|
+
data.tar.gz: f3337ceb067ec0460c8d5ad6fee7b1d088ac07ba15833f550b5b6ea19afc9e4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac88bdf60364d157efbefdaa425c8467bd93a65d70ff884f9a6322172a6b3d1858f474eb2ebf30708a9bef18deb8a0cba6358e46e7c9c5af6f9ff80099461701
|
7
|
+
data.tar.gz: e2b2894bd450158aba7f62f778a34ac29958a3eef25d13db0b3b37b539165f00d2ea39515be57eb169ba7af93a602f06af6a7dc4d768201c9c5a90ad949580ab
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
curlyq (0.0.
|
4
|
+
curlyq (0.0.16)
|
5
5
|
gli (~> 2.21.0)
|
6
6
|
nokogiri (~> 1.16.0)
|
7
7
|
selenium-webdriver (~> 4.16.0)
|
@@ -13,16 +13,16 @@ GEM
|
|
13
13
|
gli (2.21.5)
|
14
14
|
nokogiri (1.16.7-arm64-darwin)
|
15
15
|
racc (~> 1.4)
|
16
|
-
parallel (1.
|
16
|
+
parallel (1.26.3)
|
17
17
|
parallel_tests (3.13.0)
|
18
18
|
parallel
|
19
19
|
pastel (0.8.0)
|
20
20
|
tty-color (~> 0.5)
|
21
|
-
power_assert (2.0.
|
21
|
+
power_assert (2.0.4)
|
22
22
|
racc (1.8.1)
|
23
|
-
rake (13.1
|
24
|
-
rdoc (6.3.
|
25
|
-
rexml (3.3.
|
23
|
+
rake (13.2.1)
|
24
|
+
rdoc (6.3.4.1)
|
25
|
+
rexml (3.3.9)
|
26
26
|
rubyzip (2.3.2)
|
27
27
|
selenium-webdriver (4.16.0)
|
28
28
|
rexml (~> 3.2, >= 3.2.5)
|
@@ -42,12 +42,13 @@ GEM
|
|
42
42
|
tty-spinner (0.9.3)
|
43
43
|
tty-cursor (~> 0.7)
|
44
44
|
tty-which (0.5.0)
|
45
|
-
unicode-display_width (2.
|
46
|
-
websocket (1.2.
|
47
|
-
yard (0.9.
|
45
|
+
unicode-display_width (2.6.0)
|
46
|
+
websocket (1.2.11)
|
47
|
+
yard (0.9.37)
|
48
48
|
|
49
49
|
PLATFORMS
|
50
50
|
arm64-darwin-20
|
51
|
+
x86_64-darwin-20
|
51
52
|
|
52
53
|
DEPENDENCIES
|
53
54
|
curlyq!
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ _If you find this useful, feel free to [buy me some coffee][donate]._
|
|
13
13
|
[jq]: https://github.com/jqlang/jq "Command-line JSON processor"
|
14
14
|
[yq]: https://github.com/mikefarah/yq "yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor"
|
15
15
|
|
16
|
-
The current version of `curlyq` is 0.0.
|
16
|
+
The current version of `curlyq` is 0.0.16.
|
17
17
|
|
18
18
|
CurlyQ is a utility that provides a simple interface for curl, with additional features for things like extracting images and links, finding elements by CSS selector or XPath, getting detailed header info, and more. It's designed to be part of a scripting pipeline, outputting everything as structured data (JSON or YAML). It also has rudimentary support for making calls to JSON endpoints easier, but it's expected that you'll use something like [jq] to parse the output.
|
19
19
|
|
@@ -46,7 +46,7 @@ SYNOPSIS
|
|
46
46
|
curlyq [global options] command [command options] [arguments...]
|
47
47
|
|
48
48
|
VERSION
|
49
|
-
0.0.
|
49
|
+
0.0.16
|
50
50
|
|
51
51
|
GLOBAL OPTIONS
|
52
52
|
--help - Show this message
|
data/bin/curlyq
CHANGED
@@ -149,10 +149,7 @@ command %i[html curl] do |c|
|
|
149
149
|
output.delete_if(&:nil?)
|
150
150
|
output.delete_if(&:empty?)
|
151
151
|
|
152
|
-
if output.nil? || output.empty?
|
153
|
-
print_out([], global_options[:yaml], raw: options[:raw], pretty: global_options[:pretty])
|
154
|
-
Process.exit 1
|
155
|
-
end
|
152
|
+
exit_now!('No results') if output.nil? || output.empty?
|
156
153
|
|
157
154
|
output.map! { |o| o[options[:raw].to_sym] } if options[:raw]
|
158
155
|
|
@@ -492,10 +489,7 @@ command :images do |c|
|
|
492
489
|
end
|
493
490
|
end
|
494
491
|
|
495
|
-
if output.nil? || output.empty?
|
496
|
-
print_out([], global_options[:yaml], raw: options[:raw], pretty: global_options[:pretty])
|
497
|
-
Process.exit 1
|
498
|
-
end
|
492
|
+
exit_now!('No results') if output.nil? || output.empty?
|
499
493
|
|
500
494
|
print_out(output, global_options[:yaml], pretty: global_options[:pretty])
|
501
495
|
end
|
data/lib/curly/curl/html.rb
CHANGED
@@ -731,10 +731,11 @@ module Curl
|
|
731
731
|
]
|
732
732
|
headers = @headers.nil? ? '' : @headers.map { |h, v| %(-H "#{h}: #{v}") }.join(' ')
|
733
733
|
compress = @compressed ? '--compressed' : ''
|
734
|
-
@source = `#{@curl} -#{flags} #{compress} #{headers} '#{@url}' 2>/dev/null
|
734
|
+
@source = `#{@curl} -#{flags} #{compress} #{headers} '#{@url}' 2>/dev/null`.strip.utf8
|
735
735
|
agent = 0
|
736
|
+
|
736
737
|
while @source.nil? || @source.empty?
|
737
|
-
@source = `#{@curl} -#{flags} #{compress} -A "#{agents[agent]}" #{headers} '#{@url}' 2>/dev/null
|
738
|
+
@source = `#{@curl} -#{flags} #{compress} -A "#{agents[agent]}" #{headers} '#{@url}' 2>/dev/null`.strip.utf8
|
738
739
|
break if agent >= agents.count - 1
|
739
740
|
end
|
740
741
|
|
data/lib/curly/string.rb
CHANGED
@@ -6,6 +6,24 @@
|
|
6
6
|
## @return [String] cleaned string
|
7
7
|
##
|
8
8
|
class ::String
|
9
|
+
##
|
10
|
+
## Discard invalid characters and output a UTF-8 String
|
11
|
+
##
|
12
|
+
## @return [String] UTF-8 encoded string
|
13
|
+
##
|
14
|
+
def utf8
|
15
|
+
encode('utf-16', invalid: :replace).encode('utf-8')
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
## Destructive version of #utf8
|
20
|
+
##
|
21
|
+
## @return [String] UTF-8 encoded string, in place
|
22
|
+
##
|
23
|
+
def utf8!
|
24
|
+
replace utf8
|
25
|
+
end
|
26
|
+
|
9
27
|
## Remove extra spaces and newlines, compress space
|
10
28
|
## between tags
|
11
29
|
##
|
data/lib/curly/version.rb
CHANGED
data/src/_README.md
CHANGED
@@ -13,7 +13,7 @@ _If you find this useful, feel free to [buy me some coffee][donate]._
|
|
13
13
|
[jq]: https://github.com/jqlang/jq "Command-line JSON processor"
|
14
14
|
[yq]: https://github.com/mikefarah/yq "yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor"
|
15
15
|
|
16
|
-
The current version of `curlyq` is <!--VER-->0.0.
|
16
|
+
The current version of `curlyq` is <!--VER-->0.0.15<!--END VER-->.
|
17
17
|
|
18
18
|
CurlyQ is a utility that provides a simple interface for curl, with additional features for things like extracting images and links, finding elements by CSS selector or XPath, getting detailed header info, and more. It's designed to be part of a scripting pipeline, outputting everything as structured data (JSON or YAML). It also has rudimentary support for making calls to JSON endpoints easier, but it's expected that you'll use something like [jq] to parse the output.
|
19
19
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curlyq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|