Logo

dev-resources.site

for different kinds of informations.

Using htmlq to filter web data

Published at
8/18/2024
Categories
htmlq
html
curl
filter
Author
anks
Categories
4 categories in total
htmlq
open
html
open
curl
open
filter
open
Author
4 person written this
anks
open
Using htmlq to filter web data

Similar to the jq, the htmlq facilitates the filtering of html data. It can be utilized along with the curl command.

To filter with id: article-body

$ curl -s https://dev.to/anks/using-jq-to-filter-json-data-36c5 | htmlq '#article-body'

Enter fullscreen mode Exit fullscreen mode

This will filter all codeblocks on a specified dev.to page:

$ curl -s https://dev.to/anks/using-jq-to-filter-json-data-36c5 | htmlq '[class="highlight js-code-highlight"]'
Enter fullscreen mode Exit fullscreen mode

To filter out non-code text from the page:

$ curl -s https://dev.to/anks/using-jq-to-filter-json-data-36c5 | htmlq '#article-body>p'
<p>Basic Elements</p>
<p>n ∉ [0, ∞), int</p>
<p>Ex.</p>
<p>file.json<br>
</p>
<p>To filter ids:<br>
</p>
<p>To return value of <code>name</code> key when id is 1<br>
</p>
<p>To filter ids as json<br>
</p>
<p>Ref. :<br>
<a href="https://stedolan.github.io/jq/">https://stedolan.github.io/jq/</a><br>
<a href="https://programminghistorian.org/en/lessons/json-and-jq">https://programminghistorian.org/en/lessons/json-and-jq</a></p>
Enter fullscreen mode Exit fullscreen mode

To filter out non-code text from the page and to return the output in text format:

$ curl -s https://dev.to/anks/using-jq-to-filter-json-data-36c5 | htmlq -t '#article-body>p'
Basic Elements
n ∉ [0, ∞), int
Ex.
file.json

To filter ids:

To return value of name key when id is 1

To filter ids as json

Ref. :
https://stedolan.github.io/jq/
https://programminghistorian.org/en/lessons/json-and-jq

Enter fullscreen mode Exit fullscreen mode

Ref.
https://github.com/mgdm/htmlq

curl Article's
30 articles in total
Favicon
How to Ignore cURL SSL Errors
Favicon
How to Use cURL to Download Files?
Favicon
Unlocking the Power of cURL Set Headers for Web Development
Favicon
The Essential Guide to cURL Set Headers for Developers
Favicon
What is HTTP 405 Error? (Method Not Allowed)
Favicon
Boost Your Network Control with Curl SOCKS5 Proxies
Favicon
How to Use cURL GET Requests
Favicon
Unlock Efficient IP Management with Curl Proxy
Favicon
How Does Curl Work and Enhance File Transfers Across Platforms
Favicon
How Does Curl Work to Simplify Data Transfers and Testing
Favicon
cURL vs Wget: Key Differences Explained
Favicon
How to Make DELETE Requests Using the curl_init() Function in PHP
Favicon
Using htmlq to filter web data
Favicon
Harder HTB: Using only the terminal
Favicon
Vault CLI in Containers
Favicon
How to Route cURL Requests Through a Proxy Server
Favicon
TLS Fingerprint äŋč­·įš„įķēįŦ™
Favicon
Manage Telegram Webhooks Using curl
Favicon
Introducing CurlDock: Simplify API Testing with Docker and Curl
Favicon
CURL - All methods and Usage ✅
Favicon
uploading to s3 with bash
Favicon
Curl on FTP
Favicon
Build your own curl in Golang
Favicon
Build Your Own curl - Rust
Favicon
Download file using curl
Favicon
How to Use cURL For Web Scraping
Favicon
Maintain a Healthy Sense of Caution Whenever Running a `curl|bash` Command
Favicon
How to Use a Proxy in PHP with cURL
Favicon
Curl: Redirect output to file
Favicon
How to use cURL in PHP

Featured ones: