Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid big websites #64

Open
athammad opened this issue Jun 17, 2019 · 0 comments
Open

Avoid big websites #64

athammad opened this issue Jun 17, 2019 · 0 comments

Comments

@athammad
Copy link

athammad commented Jun 17, 2019

Hi Salim,

thank you for this wonderful library! It's really powerful.

I am trying to understand how if there is a way to skip websites that are too big to be crawled.
In the following example I am trying to crawl a list of websites and extract the pages with the email address but I obviously don't want the last website (The Sydney Morning Herald newspaper) to be scraped.
Is there a way to avoid this or to make the function skip if it's taking too long or the number of pages are above a given threshold?

thank you,
Ahmed

library(Rcrawler)
sample_web<-c("www.parentskills.com.au",
  "www.huggies.com.au",
  "www.babies2infinity.com.au",
  "www.smh.com.au")  

results<-lapply(sample_web, function(x){
  Rcrawler(Website = x,MaxDepth =1, saveOnDisk=FALSE,
           KeywordsFilter=c("mail","contact","about"),
           KeywordsAccuracy = 70)

    INDEX$Url<-INDEX$Url%>%
    str_extract(.,"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
  myINDEX<-na.omit(INDEX$Url)
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant