📜 ⬆️ ⬇️

What day is the best to publish a post on Habré?

Prepared an important post and want to quickly tell the world about it? It will be insulting to publish it on the day when no one enters the Habr. Exactly 5 months ago, BitLy conducted a study where he told what time it was best to post on Facebook, Twitter, and Tumblr (a Russian translation with more visual infographics).



Are there such days of the week when it is best to publish on your favorite Habré? Is Monday a hard day or is everyone actively working after the weekend? Friday fun goes with friends for a beer or on Habré in the comments? Nothing interferes with the mini-study itself. Let's find out!

Disclaimer


The study does not pretend to objectivity, contains logical and technical errors, the written code needs refactoring, is written in haste, and uses non-optimal technologies. And still managed to collect enough useful information for a number of conclusions.
')

Assumptions and research methodology


We will calculate only successful posts that:
If on Mondays, Habr is especially merciless and generous for cons, our research will keep silent about it.

How to quickly understand which day of the week is more likely to draw attention to fasting and many advantages? With a considerable margin of error, which, however, decreases with a large number of processed posts, we can assume that a good day for the post is when:

It is enough for each day of the week to sum up the number of positively rated articles, the number of comments to them, and the rating of articles. So we will understand when most people use Habr and whether they often give posts advantages.

We will scan all articles available to our user by searching their id for direct links. Let's see what about the numbers in the last posts and we will go from top to bottom to some post two years ago. I chose a range from 153,000 to 90000, and ran the algorithm on several different ranges within this block. Cool? And easy! Let's go write the code.

Program


Another error in this study: the date is taken not from the post, but from the first commentary to it. So quickly, because the comments have datetime available, and the date of the post would have to parse from the Russian language (which is also easy, but why). For scanning posts, I decided to use JavaScript to get both the session transfer and easy data retrieval on the page directly through jquery. All this may be ugly, but it saved a lot of time, and in fact the code took half an hour. For the code to work, you need to disable the same origin policy, I did it using the CORS plug-in for FireFox. I deliberately processed synchronously in one stream with small pauses, so as not to load the laptop, give the browser time to render, and bombing Habr with dozens of requests per second is ugly, although this is a drop in the ocean.

Articles that are not available or without rating are skipped. This is the main JavaScript:
$(document).ready(function() { var all = 0; var success = 0; var failed = 0; var daysProcessed = [0, 0, 0, 0, 0, 0, 0]; var daysScore = [0, 0, 0, 0, 0, 0, 0]; var daysComments = [0, 0, 0, 0, 0, 0, 0]; function processPage(url) { $.ajax({url: url, success: function(data) { if (data.indexOf('   ') != -1) { failed++; $('#failed').text(failed); return; } try { $('#loader').html(data); } catch(e) {} setTimeout(function() { var score = $('.score:first').text(); if (score != '' && score.charCodeAt(0) != 8212) { var sign = 1; if (score.charCodeAt(0) == 8211) { sign = -1; score = score.substr(1); } var intScore = sign * parseInt(score); var comments = $('#comments_count').text(); var intComments = parseInt(comments); if (intComments > 0 && sign == 1) { //Do we need only positive? var date = $('time:first').attr('datetime'); date = new Date(date); var intDay = date.getDay(); success++; $('#success').text(success); daysProcessed[intDay]++; daysScore[intDay] += intScore; daysComments[intDay] += intComments; $('#processed_' + intDay).text(daysProcessed[intDay]); $('#score_' + intDay).text(daysScore[intDay]); $('#comments_' + intDay).text(daysComments[intDay]); } else { failed++; $('#failed').text(failed); } } else { failed++; $('#failed').text(failed); } }, 1); }, async: false, error: function () { failed++; $('#failed').text(failed); }}); } var i = 153000; var interval = setInterval(function() { try { processPage('http://habrahabr.ru/post/' + i + '/'); } catch (e) { failed++; $('#failed').text(failed); } all++; $('#all').text(all); i--; if (i < 90000) { clearInterval(interval); } }, 0); }); 


Primitive visualization solely for fun and clarity, everyone likes tsiferki in realtime:
 <html> <head> <script type="text/javascript" src="http://yandex.st/jquery/1.8.2/jquery.js"></script> <script type="text/javascript"> //,    </script> </head> <body> <div>All processed: <span id="all">0</span></div> <div>All success: <span id="success">0</span></div> <div>All failed: <span id="failed">0</span></div> <br> <div>Mondays processed: <span id="processed_1">0</span></div> <div>Mondays total score: <span id="score_1">0</span></div> <div>Mondays total comments: <span id="comments_1">0</span></div> <br> <div>Tuesdays processed: <span id="processed_2">0</span></div> <div>Tuesdays total score: <span id="score_2">0</span></div> <div>Tuesdays total comments: <span id="comments_2">0</span></div> <br> <div>Wednesdays processed: <span id="processed_3">0</span></div> <div>Wednesdays total score: <span id="score_3">0</span></div> <div>Wednesdays total comments: <span id="comments_3">0</span></div> <br> <div>Thursdays processed: <span id="processed_4">0</span></div> <div>Thursdays total score: <span id="score_4">0</span></div> <div>Thursdays total comments: <span id="comments_4">0</span></div> <br> <div>Fridays processed: <span id="processed_5">0</span></div> <div>Fridays total score: <span id="score_5">0</span></div> <div>Fridays total comments: <span id="comments_5">0</span></div> <br> <div>Saturdays processed: <span id="processed_6">0</span></div> <div>Saturdays total score: <span id="score_6">0</span></div> <div>Saturdays total comments: <span id="comments_6">0</span></div> <br> <div>Sundays processed: <span id="processed_0">0</span></div> <div>Sundays total score: <span id="score_0">0</span></div> <div>Sundays total comments: <span id="comments_0">0</span></div> <div id="loader" style="display:none"></div> </body> </html> 


It looked like this




results


Finally, results! The script worked for two days at three different intervals of approximately the same size.

The total readings for all intervals:
Total processed: 35690
Of them successfully: 21189
With access error: 14499
Lost bulletins: 2 :)
Day of the weekTotal postsprosCommentsPros / PostsComments / Posts
Monday363713603517808437.4048.96
Tuesday371914056619426437.7952.23
Wednesday370213576718408136.6749.72
Thursday350712893617894036.7651.02
Friday350613106317002537.3848.49
Saturday1573640738537240.7354.27
Sunday1545723769146546.8459.20

findings



So when is it still published?


For plus signs - Monday, Tuesday, Friday.
For comments - Tuesday, Wednesday, Thursday.

This post was posted on Monday. Have a nice week and good posts to you, Habrovchane!


image

Source: https://habr.com/ru/post/153995/


All Articles