3 ms·
Cool. If you want an smaller alternative, just getting upvoted ids is easy enough in python import requests from bs4 import BeautifulSoup with req
by ashish01 6y ago
Cool. If you want an smaller alternative, just getting upvoted ids is easy enough in python
import requests
from bs4 import BeautifulSoup
with requests.Session() as session:
page = 1
while True:
resp = session.get(
f"https://news.ycombinator.com/upvoted?id=ashish01&p={page}",
cookies={"user": "get this from your browser"},
)
tree = BeautifulSoup(resp.text)
links = [x["href"] for x in tree.select(".subtext .age a")]
if len(links) == 0:
break
for i, link in enumerate(links):
print(page, i, link.split("=")[1])
page = page + 1
- pabs3 6y agoYou could also use the haxor Python library that wraps the HN API: https://github.com/avinassh/haxor https://github.com/avinassh/haxor