Live data from Hacker News

Show HN: Days Since Last Elon

dayssincelastelon.com

11–13 of 13 posts

Re: Show HN: Days Since Last Elon

#11
post #10
post #9

Earlier quoted context omitted.

I _had_ no good answer for the Google News result until you prompted me to Inspect source just now... I'm basically scanning for tags and searching the text within. Doing a Google News inspect, it appears that their links actually have no text, but are sibling elements of an tag. So, I need to figure out how to parse that correctly...

> Doing a Google News inspect, it appears that their links actually have no text, but are sibling elements of an tag. So, I need to figure out how to parse that correctly... I just checked Google News myself, and you are correct that the sibling tag has the text. However, the tag with the link has it too, but as a prop instead of being nested inside. Unless I am mistaken about the use case of that prop here, you can…

Yep, that's right.

I was _hoping_ to get away with the same xml-parsing for each site, but I guess I'll need to customize

Re: Show HN: Days Since Last Elon

#12
post #11
post #10

Earlier quoted context omitted.

> Doing a Google News inspect, it appears that their links actually have no text, but are sibling elements of an tag. So, I need to figure out how to parse that correctly... I just checked Google News myself, and you are correct that the sibling tag has the text. However, the tag with the link has it too, but as a prop instead of being nested inside. Unless I am mistaken about the use case of that prop here, you can…

Yep, that's right. I was _hoping_ to get away with the same xml-parsing for each site, but I guess I'll need to customize

Practically speaking, you might actually sorta get away with it by using a single if-check, as long as you go with the aria-label approach instead of the sibling node search.

My logic is that it is very unlikely that another website will copy over the exact html layout of Google News, so the is only going to work there. But I bet that Google News is far from the only website that has the article title text inside the aria-label prop in the tag.

So you can cover a heavy majority of websites you care about (if not all of them) by just checking both the inner text and (in case the inner text is absent) the aria-label prop. No need for any custom logic implemented just for Google News, as it would likely solve this issue for a lot of other sources.

Re: Show HN: Days Since Last Elon

#13
post #8
post #3

Earlier quoted context omitted.

Calendars for a number of news sites and aggregators, showing, per their methodology, of when "elon" appeared on their front page. I have to say that a couple of their results seem suspect to me so I question the methodology

OP here. Happy to share any details as I deal with the hug-of-death... What seemed off to you?

For one this article is now on the main page of hacker news and it reports four days since last Elon on hacker news :D Might just be that it hasn’t been on the front page long?
Post reply on HN