Giter Site home page Giter Site logo

lawzava / scrape Goto Github PK

View Code? Open in Web Editor NEW
138.0 5.0 30.0 153 KB

CLI utility to scrape emails from websites

Home Page: https://snapcraft.io/scrape

License: MIT License

Go 61.16% Makefile 10.71% Ruby 28.13%
scrape-emails scraper cli cli-utility golang email snap snapcraft hacktoberfest

scrape's Issues

error while visiting: Forbidden domain

Hi,

When I pass the domain https://php.com then it returns error while visiting: Forbidden domain this is because the line scrape.go#L90 call the function trimProtocol scrape.go#L107 and it returns .com .

Basically Trim returns a slice of the string s with all leading and trailing Unicode code points contained in cutset removed.

Instead of Trim if we use TrimPrefix then it returns the correct domain php.com not .com. i.e.

return strings.TrimPrefix(strings.TrimPrefix(requestURL, "http://"), "https://")

If I'm right then can you please update these chages.

FYR: https://play.golang.org/p/vjrqxFPsj_U

My code:

url := "https://php.com"
params := scraper.Parameters{
		Async:               true,
		Emails:              true,
		PrintLogs:           isDevelopment(),
		Recursively:         false,
		Website:             url,
	}
s := scraper.New(params)
err := s.Scrape(&emails)

Error: can't scrape sites with http://

Tried to scrape site:
./scrape -w "http://sneakycorp.htb" --debug

Got result:

[000001] 1 [ 1 - request] map["url":"https://sneakycorp.htb"] (50.331µs)
[000002] 1 [ 1 - error] map["status":"" "url":"https://sneakycorp.htb"] (53.622255ms)

There is no HTTPS server.

ERROR: encountered exception 'Uncaught' (122:21)

In the below code when I set JSWait true then it returns the output with the error in the console:

ERROR: encountered exception 'Uncaught' (122:21)

If I set JSWait to false then It will not show any error.

em := []string{}
p := scraper.Parameters{
    Async:               true,
    Emails:              true,
    FollowJSWaitExternalLinks: false,
    JSWait:              true,
    MaxDepth:            9,
    PrintLogs:           isDevelopment(),
    Recursively:         false,
    Website:             website,
}
s := scraper.New(p)
err := s.Scrape(&em)

Why I am getting this error?

Is it possible to suppress the mentioned error with JSWait true?

Wait indefinitely with --js option

The app sticks on c.Wait() https://github.com/lawzava/scrape/blob/master/scraper/scrape.go#L70 when I try the --js option.
Any idea ?

I use chromium under Windows 10 and the following command :

scrape --js --debug #default website

In debug logs I have a kind of js error, but it doesn't help me :

[000039] 1 [     5 - scraped] map["url":"https://lawzava.com/contact/"] (6.8101774s)
2020/10/01 16:58:47 executing chromedp: could not retrieve attribute "innerHTML": exception "Uncaught" (1:10): TypeError: Cannot read property 'innerHTML' of undefined
    at <anonymous>:2:11
    at <anonymous>:3:4

The mail is well collected in scrapedEmails variable...

Homebrew package

We already have a nice linux installation with snap, I am missing a mac installation with Homebrew.

Is it possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.