"Crawl Web with follow_link_with_matching_url returning empty"
Hi, I discovered rapidminer recently and I am impressed with its usability.
I am crowling the website and downloading some information from there (it is in portuguese):
http://www.portaldatransparencia.gov.br/servidores/Servidor-ListaServidores.asp?bogus=1&Pagina=1
I have a rule that download all pages with the matching regular expression:
.+Servidor-DetalhaServidor.+|.+Servidor-DetalhaRemuneracao.+
And it is working great. But in this page there is a "next" button that shows more samples. The "next" button send me to the following url:
http://www.portaldatransparencia.gov.br/servidores/Servidor-ListaServidores.asp?bogus=1&Pagina=2
So I inserted a "follow_link_with_matching_url" rule with the following regular expression:
.+Servidor-ListaServidores.+
But when I insert this rule I get empty results. Why is this happening?
Best Regards
Alan
Best Answer
-
Edin_Klapic Employee-RapidMiner, RMResearcher, Member Posts: 299 RM Data Scientist
Hi Alan,
as @Thomas_Ott pointed out I highly assume that the problem results in the reason that the content of the pagination is based on JavaScript. Unfortunately, the Web crawler is not capable of accessing this.
If I get you right you want to extract the data from every page. The website seems quite easy structured so you could e.g. access every page incrementally.
In this case you could use the Loop operator and set the parameter number of iterations to the maximum number of pages.
Then you could directly access each page using the URL
http://www.portaldatransparencia.gov.br/servidores/Servidor-ListaServidores.asp?bogus=1&Pagina=%{iteration}
In this case the macro iteration reflects the number of the page.
Please turn off the Parallel execution for the Loop operator, otherwise your IP might get blacklisted.
I hope this gets you nearer to the expected result,
Edin
1
Answers
Hi, Would you please share the process? Would make it easier to inspect. Thanks!
Hi, The process is attached! Tnaks.
Hi Thomas,
When you say "process" you mean this xml document:
Best Regards,
Alan
Hi, I was speaking with @Edin_Klapic regarding this. It might be related to some Javascript in that page. I believe he might have a workaround.
Hi Edin,
Thank you very much. The for loop worked perfecly.
Best Regards
Alan
Hi @Thomas_Ott
I used the Loop operator but I am facing a very annoying problem. In each loop interation the WebCrawler operator ovewrite the file, once the files are written, for example, 0.tml to 14.html.
Is is possible the WebCrawler give another name for saved files? I am trying to rename the files after the loop but I still did not find a solution.
Best Regards,
Alan
Hi Alan,
Let me try a wild guess - You might need to change the filename which you write by combining macros.
Or try using the macro %{a}. It reflects the number of executions for the corresponding operator.
In case this does not work, could you please share your process again?
Best,
Edin
I think you can use a macro value to give them all a unique name. You might try appending the file extension name with txt_%{iteration} or txt_%{t}, the %{t} macro is the system time.