0

Im Am building an application In Blazor That Use HtmlAgilityPack to Scrape some data on Amazon. In The HtmlDocument i have this html element:

<a class="some class"href="/gp/slredirect/picassoRedirect.html/ref=pa_sp_atf_aps_sr_pg1_1?ie=UTF8&adId=A066363530CJUGC1HFGDT&url=%2FLABISTS-Raspberry-Barebone-MicroSD-Alimentatore%2Fdp%2FB082TV6M86%2Fref%3Dsr_1_1_sspa%3F__mk_it_IT%3D%25C3%2585M%25C3%2585%25C5%25BD%25C3%2595%25C3%2591%26dchild%3D1%26keywords%3Draspberry%26qid%3D1611681055%26sr%3D8-1-spons%26psc%3D1&qualifier=1611681054&id=2959588097891449&widgetName=sp_atf">

By Clicling that Url From amazon itself i got redirect to the real Url of The selected Item the is:

https://www.amazon.it/LABISTS-Raspberry-Barebone-MicroSD-Alimentatore/dp/B082TV6M86/ref=sr_1_1_sspa?__mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=raspberry&qid=1611681055&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzOEszMkFXR0ZRMjJTJmVuY3J5cHRlZElkPUEwNzA1MjYxMTg2TlhNUjg0M0dLQyZlbmNyeXB0ZWRBZElkPUEwNjYzNjM1MzBDSlVHQzFIRkdEVCZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU=

Is There a way to extract the second Url from the first one (inside the htmlelement "a" in the tag "href") by web Scraping or without opening amazon from a browser?

Leo
  • 33
  • 1
  • 7
  • Try this https://stackoverflow.com/a/659929/3513848? – Suprabhat Biswal Jan 26 '21 at 17:44
  • if the referenced url is contained in the query string you can simply extract the query string. However if the redirected url is a bit different (because it's produced by the server), you really need to request the first url and wait for the response to examine the redirected url which is contained in the `Location` header. – King King Jan 26 '21 at 18:03

0 Answers0