Help

Re: IMPORT HTML data into table

1051 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Remy_Vignaux
5 - Automation Enthusiast
5 - Automation Enthusiast

Hello
is it possible to import data from an HTML web page into Airtable
for example, i would like to retrieve the data “priceValue” in coinmarketcap.com/currencies/solana
image

i’m trying with DataFetcher but it seems not to work properly.

Is there another way to achieve ?

thanks for your answer

2 Replies 2

Hi,
I had a similar task, but now it’s low prio among others, unfinished, so I can share my experience at that moment.
i used following method to get JSON-object from API, parse and output.

Annotation 2021-11-08 010102

Well i was able to perform the same with html
(skipped first lines to fetch…it works for different Name field values implemented in google search "site:somesite.com My Search Sentence, and script run by button)

i know there is some better way to parse HTML and i’ve “invented a wheel”, but that’s just an example it can be done quite easy. Just output(inspect) a fetch result and think how to locate your value.

...
let response = await remoteFetchAsync(word);
const pageSummary = await response.text();
let location=pageSummary.indexOf('property_name')-80;
if (location<0) throw new Error(word+' Not Found');
let pos1=pageSummary.indexOf('https:',location);
let pos2=pageSummary.indexOf('&amp;sa',pos1);
let address=pageSummary.slice(pos1,pos2).trim();

//my output is link with  "wrong" symbols and i need to correct them. 
//Maybe that part not interesting for your case
//looping because replace only works with first match, so  
function rplc(text){return text.replace('%3F','?').replace('%3D','=').
replace('%26','&').replace('%2B','+')};
let temp_adr=rplc(address);
while (temp_adr!=address) {address=temp_adr;temp_adr=rplc(address) }
await rootTable.updateRecordAsync(record.id,{ 'URL_on_BRD' : address } );


output.text(pos1+' - '+pos2);

output.inspect(address);