Sujet : Re: Slow Computing
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.miscDate : 31. May 2024, 00:40:21
Autres entêtes
Organisation : Stefan Ram
Message-ID : <Slow-20240531003307@ram.dialup.fu-berlin.de>
References : 1
Ben Collver <
bencollver@tilde.pink> wrote or quoted:
Slow Computing
First, there was "fast food" (a term coined in the 1950s).
In 1986, Carlo Petrini in Rome coined "slow food" as a counterterm.
What's vying for our attention, broadly speaking, is advertising.
And we encounter it just as much in printed magazines as on
computer screens. For me, it's not necessarily a question of speed.
In fact, I see more opportunities to filter out ads on the computer.
I've develop a custom program that curates the news reports
I consume by filtering out content deemed trivial, such as
gossip and frivolous matters.
Through the use of keywords, my program eliminates articles
containing specific phrases or terms associated with such
trivialities, much like it would filter out advertisements.
For instance, if a news item's description includes the string
"Prince Harry", that particular story would be automatically
omitted from my view, courtesy of this program.
This Python program demonstrates the fundamental process.
fn = '''output-file-20240531003240-tmpdml.html'''
output = open( fn, "w", errors='ignore' )
uri = fr'''
http://example.com/article_list.html'''
request = urllib.request.Request( uri )
resource = urllib.request.urlopen( request )
cs = resource.headers.get_content_charset()
content = resource.read().decode( cs, errors="ignore" )
# assuming each article link is in an element of type "p"
for p in re.finditer( r'''<p[^\001]*?</p>''', content, flags=re.DOTALL ):
if "Prince Harry" not in p.group( 0 ):
print( p.group( 0 ), file=output )
output.close()
subprocess.Popen( fn, shell=True ) # opens the output file in a browser!
But yes, writing all these Python programs does slow me down . . .