Recent submissions

Comment · 6 years ago
Comment · 6 years ago
No agent at all is required. I got past the anti-robot response using no user-agent header and a simple delay.
Comment · 6 years ago
Instead of using Python, here is a solution that only requires sh, curl, sed, sort, uniq and grep.

This solution uses a generous 87s delay to retrieve the Amazon pages. There are 328 films listed as "great movies" on rogerebert.com. As such, the script, named "1.sh", needs 8h to complete, e.g., the time while you are at work or sleeping. No cookies, no state, no problems.

   Usage: sh -c 1.sh > 1.html
Open 1.html in a browser and it shows whether each "great movie" is available as Prime Video or whether it is only available in some other format, such as Blu-ray, DVD, Multi-format, Hardcover. A link to the item on Amazon is provided.

   #!/bin/sh

   curl -HUser-Agent: -H'Accept: application/json' --compressed 'https://www.rogerebert.com/great-movies/page/[1-16]?utf8=%E2%9C%93&filters%5Btitle%5D=&sort%5Border%5D=newest&filters%5Byears%5D%5B%5D=1914&filters%5Byears%5D%5B%5D=2020&filters%5Bstar_rating%5D%5B%5D=0.0&filters%5Bstar_rating%5D%5B%5D=4.0&filters%5Bno_stars%5D=1'|grep -o "/reviews/great-movie-[^\\]*"|sed 's/.reviews.great-movie-//'|sort|uniq|while read x;do y=$(echo $x|sed 's/-/+/g');echo $x;curl -s --compressed -HUser-Agent: https://www.amazon.com/s/?k=$y 2>/dev/null|grep -m1 -C4 a-link-normal.a-text-bold;sleep 87;done|sed '/^[^< ]/s/.*/@&,/;1s|.*|<base href=https://www.amazon.com />&|;s/ *//;/^$/d;/^[@<]/!s|$|</a>|;1s/@//;s/@/<br>/'
Comment · 6 years ago
If Pike and his crew represent users, then the tech industry are the Talosians?

Absolute favourite episode hands down, The Cage. According to Shatner's autobiography, NBC called the pilot "too cerebral" and "too intellectual".

Comment · 6 years ago
"The Commercial Web (of Marketing)

There has always been a place for commerce and marketing on the web."

Not really true as I remember it. The web opened up to the public in 1993. There was no commerce and marketing in the beginning. Even by 1996 while commerce and marketing may have existed, e.g., Amazon founded in 1995, its place was in the background. As I rememember the early web, the foreground, the "starting point" or "portal", was something like Yahoo! You had to pick a topic (direction) that you wanted to go in. For example, if you were after music, you might end up browsing the Internet Underground Music Archive. The "front page" of the portal was predominantly non-commercial, mostly generic headings for topics. If you wanted to search out something commercial, no doubt you could but the initial starting point was intellectual curiosity. This is IMO what has been lost over time with regard to web use: intellectual curiosity and the ability to actually satisfy it. (A fun tangent here is the collections of inane queries that people type into Google. These are simultaneously hilarious and disturbing.)

As an experiment have a look at the Yahoo! page today. It is full of low quality mainstream "news". There is zero attention to intellectual curiosity. Nothing to see here, folks, but here is the latest news. For part 2 of the experiment, run a Google search for the term "music". The results are dominated by YouTube. Every result is directly or indirectly commercial (either selling something or conducting surveillance and serving ads), except one: Wikipedia. The chances of someone new to the web not following a link to YouTube or some other Google-controlled domain would seem almost nil.

The "onboarding" process for new web users is very different today than it was in the early 1990's. Perhaps it is still possible to approach the web with a sense of awe and wonder, pondering "What is out there?" However a new web user is scant likely to end up on a non-commercial website besides Wikipedia. What is out there? Surveillance, ads and an endless supply of soon-to-be-obsolete Javascript du jour.

Comment · 6 years ago
Why dump billions of dollars then? Nowhere else to spend it? Effective marketing?[1] Is no one asking this question?

"... and critically: there's no one to hold responsible for getting it wrong."

Could this be part of "AI"'s appeal? A dream of absolving businesses and individuals from accountability.[2]

1. "What's more, artificial research teams lack an awareness of the specific business processes and tasks that could be automated in the first place. Researchers would need to develop an intuition of the business processes involved. We haven't seen this happen in too many areas."

2. Including the ones who designed the "AI" system.

Comment · 6 years ago
"DNA is not code, it's just a molecule that reacts with stuff, as are all other molecules."

This sentence exemplifies the perspective to which I referred.

Comment · 6 years ago
Improved

   #/bin/sh
   test -s max-PMID||echo 32449615 > max-PMID;read x < max-PMID;h=pubmed.ncbi.nlm.nih.gov;
   test ${#x} -eq 8||rm max-PMID;sed -i "s/[0-9]\{8\}/$x/" $0;
   case $1 in update) mkfifo 1.fifo 2>/dev/null;test -p 1.fifo||exec echo need 1.fifo;
   (grep "<title>PMID .* is not available" < 1.fifo|sed 1q|sed -n 's/<title>PMID //;s/ *//;s/ .*//;wmax-PMID')&
   y=$((x+10000));seq $x $y|sed '$!s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: keep-alive\r\n\r\n|; 
   $s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: close\r\n\r\n|'|socat - ssl:$h:443 2>/dev/null|grep -o '<title>[^<]*' >1.fifo;
   ;;"")awk -v min=1 -v max=$((x-1)) 'BEGIN{srand();printf "https://'$h'/" int(min+rand()*(max-min+1)) "/\n"}';esac
Comment · 6 years ago
Comment · 6 years ago
"It's not super productive to try and understand this stuff through analogy to computers and algorithms."

You mean like this: https://ds9a.nl/amazing-dna

Having worked in both industries I prefer working with wet science people. For some reason they generally have a much healthier perspective on life. Their work is humbling because it is, and will forever be, full of unsolved mysteries, not simply because it is challenging. The other folks, whether they call themselves "scientists" or "engineers" or "developers" or "coders" or whatever, are working with something that as far as I can see has no inherent connection to the natural world, other than being a production of the human mind. Perhap that affects the perspective many of them have on life. For example, how common among them is this belief that all things, not simply computers, can be thoroughly understood and mastered. Note this is pure opinion, not fact, and I am generalising; there are exceptions to every generalisation.

Comment · 6 years ago
What if PubMed had something like Google's "I'm feeling lucky"? What if we could explore PubMed by selecting a random PubMed URL instead of searching? This script generates a random PubMed URL. To do this we need to know the maximum PMID number in the PubMed database. The current max is included in the script and will be saved in a 9-byte file named "max-PMID" when the script is run. If run with the argument "update" it will search for a newer max PMID. If a newer max PMID is found, the script updates the number in the max-PMID file and in the script itself. An alternative is to use the ftp server[1] to find the max PMID; I noticed the latest ftp update was missing new PMID's caught by this script. If run without any arguments it selects a random PMID between 1 and the max and outputs a URL. uses socat, GNU sed and requires a fifo named "1.fifo" 1. ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/

       #!/bin/sh
       test -s max-PMID||echo 32446294 > max-PMID;read x < max-PMID;x=$((x-1));h=pubmed.ncbi.nlm.nih.gov;
       test ${#x} -eq 8||exec echo weird max-PMID;sed -i "/test/s/echo [0-9]\{8\} /echo $x /" $0;
       case $1 in update) mkfifo 1.fifo 2>/dev/null;test -p 1.fifo||exec echo need 1.fifo;
       (grep "<title>PMID .* is not available" < 1.fifo|sed 1q|sed 's/<title>PMID //;s/ *//;s/ .*//;' >max-PMID)&
       y=$((x+10000));seq $x $y|sed '$!s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: keep-alive\r\n\r\n|; 
       $s|.*|GET /&/ HTTP/1.1\r\nHost: '"$h"'\r\nConnection: close\r\n\r\n|'|socat - ssl:$h:443 >1.fifo 2>/dev/null;
       ;;"")awk -v min=1 -v max=$x 'BEGIN{srand();printf "https://'$h'/" int(min+rand()*(max-min+1)) "/\n"}';esac
Comment · 6 years ago
Comment · 6 years ago
The long line of sed is out-of-date and thus "broken". For something simpler that works, try this:

   nyt tr |sed 's/ *//;/</!d'|uniq > travel.html
This will produce a simple web page of titles and URLs for each article page.

An interesting point of discussion might be the amount of third party cruft on the template article page versus the more dynamic front page. When Javascript is disabled, on each article page all images display and there are no ads. Downloading any video in the page is as simple as

   curl -O `grep -o https://[^\"]*mp4 article.html`
Comment · 6 years ago
"It's text, just send the damn text."

They only send what the user requests.

Using a software program that makes automatic requests that you are not easily in control of, e.g., a popular web browser, might give the impression that they control what is sent.

They do not control what is sent. The user does.^1

The user makes a request and they send a response.

One of the requests a fully-automatic web browser makes to NYT is to static01.nyt.com

Personally, as a user who prefers text-only, this is the only request I need to make. As such I don't really need a heavily marketed, fully-automatic, graphical, ad-blocking web browser to make a single request for some text.^2

    #! /bin/sh

    case $1 in
    world        |w*)  x=world       # shortcut: w
    ;;us         |u*)  x=us          # shortcut: u
    ;;politics   |p*)  x=politics    # shortcut: p
    ;;nyregion   |n*)  x=nyregion    # shortcut: n
    ;;business   |bu*) x=business    # shortcut: bu
    ;;opinion    |o*)  x=opinion     # shortcut: o
    ;;technology |te*) x=technology  # shortcut: te
    ;;science    |sc*) x=science     # shortcut: sc
    ;;health     |h*)  x=health      # shortcut: h
    ;;sports     |sp*) x=sports      # shortcut: sp
    ;;arts       |a*)  x=arts        # shortcut: a
    ;;books      |bo*) x=books       # shortcut: bo
    ;;style      |st*) x=style       # shortcut: st
    ;;food       |f*)  x=food        # shortcut: f
    ;;travel     |tr*) x=travel      # shortcut: tr
    ;;magazine   |m*)  x=magazine    # shortcut: m
    ;;t-magazine |t-*) x=t-magazine  # shortcut: t-
    ;;realestate |r*)  x=realestate  # shortcut: r
    ;;*)
    echo usage: $0 section
    exec sed -n '/x=/!d;s/.*x=//;/sed/!p' $0
    esac

    curl -s https://static01.nyt.com/services/json/sectionfronts/$x/index.jsonp

   Example: Make simple page of titles, article urls and captions, where above script is named "nyt".

    nyt tr |  sed '/\"headline\": \"/{s//<p>/;s/\".*/<\/p>/;p};/\"full\": \"/{s//<p>/;s/..$/<\/p>/;p};/\"link\": \"/{s///;s/ *//;s/\".*//;s|.*|<a href=&>&</a>|;p}' > travel.html

    firefox ./travel.html
Source:
https://news.ycombinator.com/item?id=22125882

The truth is that they are just sending the damn text. However you are voluntarily choosing to use a software program that is automatically making requests for things other than the text of the article, i.e., "cruft".

1. The Google-sponsored HTTP/[23] protocol is seeking to change this dynamic, so if websites sending stuff to you without you requesting it first bothers you, you might want to think about how online advertisers and the companies that enable them might use these new protocols.

2. However I might use one for for viewing images, watching video, reading PDFs, etc., offline. Web browsers are useful programs for consuming media. It is in the simple task of making HTTP requests that their utility has diminished over time. The user is not really in control.

Comment · 6 years ago

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton