Scrape Element attribute - Changing id

I would like to extract data from a hidden value on multiple pages.
The problem is that the attribute id is different on each page and I can't find a solution for that.

Here is one example :

<div id="companyContact">
    <input type="hidden" id="contact-AB0123456" value="0123456789">

The value "AB0123456" is different on each page, for example on the next page I will have :

<div id="companyContact">
    <input type="hidden" id="contact-AB987654" value="0123456789">

But I still want to get the value from all pages even if the id is different.
Could someone PLEASE help.. spent hours on that.

Thanks guys