TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Review my Code - My_Favorite_HN_Submitters

7 点作者 markerdmann超过 15 年前
The Python script is available at:<p>http://dl.getdropbox.com/u/1395097/MyFavoriteSubmitters.py<p>This script will:<p>1. Ask you for your credentials 2. Login to HN 3. Download your list of saved links 4. Use that list to generate a sorted list of your favorite submitters 5. Output that list as a simple HTML file with appropriate links. You can now easily browse the saved links of each of your favorite submitters.<p>Please use this responsibly! The idea is not to bring down the HN server with a flood of automated traffic. You'll notice that there is a delay built into the script that slows down the HTTP requests. Don't comment that out! :-)<p>While writing this script, I noticed a few interesting things:<p>The first is that HN doesn't keep a permanent record of your saved links. After 210, it starts discarding the oldest ones. Perhaps this could be changed?<p>The second is that the top-ranked submitters tend to be people who submit more links. Makes sense. One way to improve this script would be to design a formula for submitter quality. For example, take the number of submissions that you voted up and divide it by the user's total number of submissions in that period of time. This involves even more scraping of the site, though, which I'm hesitant to do before pg gives this a thumbs up or thumbs down.<p>The third thing is the extent to which the "new" page can be a no man's land where good links go to die. Many of my favorite submitters have excellent submissions with only one karma point, which is a result of the "now or never" voting phenomenon. If a new link isn't given one or two upvotes within a few minutes of being submitted (so that it appears on the front page), it has forever lost any hope of getting the votes it deserves. Perhaps this could be fixed? One idea might be to give links a "second chance" at the new page if they receive an upvote after being completely dormant for more than a week.<p>I hope you enjoy the script! I've been teaching myself programming over the past year (mostly by reading SICP and Hacker News), and I would love to receive feedback. Is there anything I could have done better? Could I have written something in a more elegant way? Is there something I did really well?<p>Thank you to everyone for making this site so amazing. I owe this community a debt of gratitude.

3 条评论

jacquesm超过 15 年前
&#62; If a new link isn't given one or two upvotes within a few minutes of being submitted (so that it appears on the front page), it has forever lost any hope of getting the votes it deserves.<p>This has been a real problem, and the last two weeks it has gotten very bad indeed.<p>The 'new' page doesn't scale.<p>A good indicator of how big the problem is at the moment is the 'age' of the oldest item on the new page. That used to be 2 to 4 hours, now even on a 'quiet' time of the day it is only 1 hour.<p>The reason why there is a cut-off at 210 elements for the 'new', 'saved' and 'news' pages is that this will reduce some performance bottlenecks. They're slowly getting shorter.<p>It's a real pity, especially for the 'saved' page because that is one use of HN, as a bookmarking service.
jacquesm超过 15 年前
Ok, a review of the code:<p>I increased the sleep to 10 seconds, 1 second is pushing it.<p>Double return of the same value in the tail of GetFavoriteSubmitters so you can drop two lines there.<p>Maybe add a linefeed at the end of every row of users so you can still make sense of it in a text editor ?<p>Missing 'close' at the end of the writing of the file. Sure, the file will be closed by the script that exits but that's sloppy.<p>That's about it.<p>The results:<p><pre><code> edw519 5 yarapavan 4 fogus 4 amichail 4 zjj 2 prabodh 2 nopassrecover 2 dreemteem 2 boundlessdreamz 2 </code></pre> All the rest of them are 'one-offs'. I guess I'm not much of a groupie :)
评论 #901918 未加载
markerdmann超过 15 年前
Clickable link:<p><a href="http://dl.getdropbox.com/u/1395097/MyFavoriteSubmitters.py" rel="nofollow">http://dl.getdropbox.com/u/1395097/MyFavoriteSubmitters.py</a>