L
L
Light7772015-04-04 08:38:11
ASP.NET
Light777, 2015-04-04 08:38:11

Find out the URL of a page?

Hello! There is such a directory page with the names of companies www.nashgorod.kz/Firms/ru/1670
And now I want to download email grabberom all email addresses on the page, but it turns out that I can only download from the first page because the URLs of other pages do not give out and still do not the url is shown when i set to display 100 entries. How to be? Is there any solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergei Rodyushkin, 2015-04-04
@SergeyRodyushkin

Oh, those Web Forms!
I think to understand the mechanism it will be enough to open the Network tab of the Chrome dev console, press different buttons and see what requests are sent.
The __EVENTTARGET and __EVENTARGUMENT fields of the POST request are responsible for performing postback actions. The script looks like this:

  1. We send a POST request to the page with arguments to set the page size to 100 records (the necessary arguments can be taken from the console, it’s not easy to take them from the page, offhand).
  2. Parsing emails.
  3. Looking for a link to the next page. We are interested in links ( a ) located inside a block with the .rgNumPart class . The pager is displayed twice, so we take only the first block.
  4. We find the element a in it , following a.rgCurrentPage . If there is none, we have looked through the list to the end.
  5. From the href attribute of the regular link we get an identifier like ctl00$MainContent$RadGrid1$ctl00$ctl03$ctl01$ctl03. This will be the new __EVENTTARGET.
  6. We send a new POST request with new arguments, go to step 2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question