New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/norden37/parser_html_page

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/norden37/parser_html_page

  • v0.0.7
  • Source
  • Go
  • Socket score

Version published
Created
Source

parser_html_page

Installation

$ go get github.com/NordeN37/parser_html_page

Methods

returns the response from the given URL. GetResponse(url string, headerSets []*models.HeaderSet) (*http.Response, error)

It uses goquery at its core. Parses the document and recursively checks the Selection ParseHtml(~)

The general method accepts a link to the page, headers, selectors. Makes a request, receives a document, and requests GetResultParseHtml(~)

Examples

package main

import (
	"encoding/json"
	"github.com/NordeN37/parser_html_page"
	pmodels "github.com/NordeN37/parser_html_page/models"
	"log"
)

func main() {
	var parse pmodels.Parse
	err := json.Unmarshal([]byte(data), &parse)
	if err != nil {
		log.Fatal(err)
	}

	result, err := parser_html_page.GetResultParseHtml(parse)
	if err != nil {
		log.Fatal(err)
	}

	byteResult, err := json.Marshal(result)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(string(byteResult))
}

var data = `{
  "URL": "https://example.com/",
  "HeaderSets": [
    {
      "Key": "User-Agent",
      "Value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0"
    },
    {
      "Key": "Accept",
      "Value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"
    },
    {
      "Key": "Content-Type",
      "Value": "text/html; charset=utf-8"
    }
  ],
  "Selection": {
    "Find": [
      {
        "Tag": "div",
        "GetValue": false,
        "Find": [
          {
            "Tag": "h1",
            "GetValue": true
          },
          {
            "Tag": "p",
            "GetValue": true
          }
        ]
      }
    ]
  }
}`

FAQs

Package last updated on 16 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc