Skip to content

Display the "H1" text don't work on all URL #2233

@SvenDruid

Description

@SvenDruid

This example program from the course, I have run with a number of URL. Some URL display space instead of the text.
Can someone tell me whats need to do, to get the text display instead of space? In that URL that not display text.

import * as cheerio from 'cheerio';
const url = "https://www.fandom.com/";
const response = await fetch(url);
if (response.ok) {
const html = await response.text();
const $ = cheerio.load(html);
console.log($("h1").text());
} else {
throw new Error(HTTP ${response.status});
}

This are exampel on URL that works

"https://warehouse-theme-metal.myshopify.com/collections/sales";
"https://flights.booking.com/flights/ARN-PMI/?type=ROUNDTRIP&adults=2&children=&cabinClass=ECONOMY&from=ARN&to=PMI&fromCountry=SE&toCountry=ES&depart=2026-05-31&return=2026-06-07&salesCountry=se&currency=SEK&lang=sv&ext-tr=rJliJi861QX6nBM7BqOMDubeF%7ESV77bh-%7E_qZ0VwPzN66HZQIfWchFw%3D%3D&aid=2421158&label=part-kayak%3Atype-precheck%3Adev-web%3Aorair-ARN%3Adestair-PMI%3Aorco-SE%3Adestco-ES%3Aadpc-BDC--PRE_sv_SE_FFDCMP2%3Aloc-se";
"https://www.ikea.com/se/sv/cat/vaxter-pp003/?filters=f-subcategories%3A20492";
"https://en.wikipedia.org/wiki/Main_Page";

"https://www.booking.com/country/al.sv.html?aid=310018;label=al-MU3Fblf7lBLIFejOC0miKAS503206508614:pl:ta:p11400:p2:ac:ap:neg:fi:tikwd-7365484456:lp9195018:li:dec:dm:ppccp=UmFuZG9tSVYkc2RlIyh9YbC4OlOULAnvxFjnh9VL-5w;ws=&gad_source=1&gad_campaignid=53806150&gbraid=0AAAAAD_Ls1IF7G80dTj7v0d-_68eNJm_2&gclid=CjwKCAiAv5bMBhAIEiwAqP9GuGsgUaI3weg6HUMrQGId9kUnuYdZIzPflHjNWU_pq6QwxCdVZHICUBoCXb4QAvD_BwE";

This are exampel on URL that display space insted of the text

"https://www.avanza.se/index/om-indexet.html/19002/omx-stockholm-30";

"https://www.sj.se/sok-resa/valj-resa/Stockholm%20Central/G%C3%A4vle%20Central/2026-02-13/2026-02-14";

"https://www.sj.se/?a=b&gclsrc=aw.ds&ds_rl=1249642&gad_source=1&gad_campaignid=24562456&gbraid=0AAAAADqt5oFr51a7x7OxgTtvng5OaSuc4&gclid=CjwKCAiAv5bMBhAIEiwAqP9GuNJAfx4gUv3AHOFOTt_RYHmxLpK_zbyAYrZ9obQ91MxWyFmJEokR0hoCmNIQAvD_BwE";

"https://www.booking.com/searchresults.sv.html?ss=Albanien&ssne=Albanien&ssne_untouched=Albanien&efdco=1&label=al-MU3Fblf7lBLIFejOC0miKAS503206508614%3Apl%3Ata%3Ap11400%3Ap2%3Aac%3Aap%3Aneg%3Afi%3Atikwd-7365484456%3Alp9195018%3Ali%3Adec%3Adm%3Appccp%3DUmFuZG9tSVYkc2RlIyh9YbC4OlOULAnvxFjnh9VL-5w&aid=310018&lang=sv&sb=1&src_elem=sb&src=country&dest_id=2&dest_type=country&checkin=2026-06-03&checkout=2026-06-09&group_adults=2&no_rooms=1&group_children=0&sb_travel_purpose=leisure&sb_lp=1";

Sven

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions