Tell me about my question! [duplicate]

I'm a narcissist. (Not Really)

I'm also very lazy... (Not Really)

So I want to know the score of this question, and how many people have viewed it.

But I'm too lazy to check myself...

Challenge

Your challenge is to output the score of this question, and how many views there are. No input may be taken, and output may be given as pretty much anything as long as it's clear where the two numbers are outputted. So, all of the following are valid:

[1, 1]
score 1, 1 view
1 1
1, 1
1........1
HELLO1WORLD1


Note that pluralization matters, so "1 views" is invalid output.

I am very lazy, so I want this code to be as short as possible.
You may assume that there is an internet connection.
You may want to use the SE API. For reference, this question has id 111115.

Rules

No URL shorteners are allowed.
You may assume that votes are not expanded (for users below 1000 rep: users with at least 1000 rep can click on the score of a post to see the upvotes and downvotes individually. You may assume that this was not done).

Scoring

This is a code-golf challenge, so the shortest valid submission by March 14th (Pi Day) wins! Happy golfing!

marked as duplicate by mbomb007, Sriotchilism O'Zaic, Qwerp-Derp, Mego♦ code-golf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 11 '17 at 7:01

• Related: Stack Exchange Vote Counter – Dennis Feb 24 '17 at 2:18
• @Dennis Hm. I did not find that in my search. Strange. Also, I have a question that you may be able to answer. Does the API tell you how many upvotes I have, or just the overall score? – HyperNeutrino Feb 24 '17 at 2:20
• Is usage of the SE API required? I don't see how it's "definitely" necessary (for example, one could scrape and parse the HTML of this page). – Doorknob Feb 24 '17 at 2:20
• @Doorknob That is true. Also, thanks for correcting my code; I forgot about being politically correct (I'm rather uncareful about that). – HyperNeutrino Feb 24 '17 at 2:21
• @HyperNeutrino I can't find the "views" attribute on the SE api, so I don't think it's even possible to solve this with the SE api. – NoOneIsHere Feb 24 '17 at 2:21

T-SQL, 49 bytes

According to the FAQ the database will be updated on Sunday 0300 UTC so this is when you'll get your result. So I'm hoping you're a patient lazy (not really) narcissist (not really).

select Score,ViewCount
from Posts
where Id=111115


• Haha. That's an interesting solution. :) I'm upvoting it, but I'm not considering it a valid solution for accepting, because it isn't always up to date (what if I get 10 upvotes between Sunday and Friday? I really want to see all those upvotes coming in... :P). But keep this here, good job! – HyperNeutrino Feb 24 '17 at 14:09
• @HyperNeutrino that's fair enough :) thanks – ʰᵈˑ Feb 24 '17 at 14:22
• chat.stackexchange.com/transcript/message/35817456#35817456 – mbomb007 Mar 3 '17 at 22:43

JavaScript + jQuery, 109 bytes

$.get('//api.stackexchange.com/questions/111115?site=codegolf',x=>alert([(a=x.items[0]).view_count,a.score])) <!-- Click run | below! --> <!-- v --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> Same strategy as my answer on a related question. • Yay, good job! +1 – HyperNeutrino Feb 24 '17 at 2:41 • @HyperNeutrino Editing to add comments. – NoOneIsHere Feb 24 '17 at 2:41 • Oh, okay. I just rolled that back because you submitted, but if you edit it, I'll unrollback. – HyperNeutrino Feb 24 '17 at 2:45 • @HyperNeutrino Actually, getting comments is a completely different request. I'm not going to add that. – NoOneIsHere Feb 24 '17 at 2:46 • Yeah. I think it actually requires /questions/comments/{ids}, so don't bother. I've rolled back already. – HyperNeutrino Feb 24 '17 at 2:47 Javascript (ES6), 128 bytes fetch('//api.stackexchange.com/questions/111115?site=codegolf').then(x=>x.text()).then(x=>alert([(x=x.match(/\d+/g))[10],x[8]]))  • Huh, how long has fetch existed? I've never heard of it before... – ETHproductions Feb 24 '17 at 12:44 • @ETHproductions it's been in Chrome and Firefox since mid-2015 :D – nderscore Feb 24 '17 at 16:31 • Nice solution! +1 – HyperNeutrino Feb 26 '17 at 20:17 JavaScript, 129 105 bytes Non-API solution. f=(v,n)=>document.getElementsByClassName(v)[n].innerText;alert([f("vote-count-post",0),f("label-key",3)])  You should be able to run this in your browser's developer tools. • Yep, this works! Just one side note, when I expand out the votes (1000 rep feature), it no longer works, so I'll add into the specs that you may assume that the votes are not expanded. +1! :) – HyperNeutrino Feb 24 '17 at 3:02 • @HyperNeutrino It should now work for expanded votes. – Oliver Feb 24 '17 at 15:08 • Nice job! It's not necessary, but I see that you have shortened your solution as well. I've tested it and it now works as expected, giving me my upvote count, downvote count, and view count. – HyperNeutrino Feb 24 '17 at 15:28 Bash + curl, 8290999590 89 bytes Edit 1: I had to do better searches to omit the keywords from my own answer, hence more bytes. Edit 2: Using sed magic I got the byte count down again curl -L codegolf.stackexchange.com/q/111115>f grep -m1 t-post f sed -n '/key.>\r/{n;p}' f  When curl accesses that short URL format, it receives a 302 redirection page that has this question's URL in the body section, so the -L option is needed to follow it. After that, it downloads the source code of this html page to a file named f. Then I search the keywords associated with the statistics wanted and print the answer on STDOUT. Test: I redirect STDERR just for clarity (stats at the time of this posting) me@LCARS:/PPCG$ ./Q_stats.sh 2> /dev/null
<span itemprop="upvoteCount" class="vote-count-post ">7</span>
<b>398 times</b>


The output is pretty verbose, but the syntax of both lines is basically junk text>VALUE<more junk text, which should be allowed according to the challenge description.

• Yep, since the "junk text" is always consistent, this is a valid answer. Nice job! +1 – HyperNeutrino Feb 24 '17 at 14:10
• Removed my URL comment and explained it in the answer. – seshoumara Mar 3 '17 at 20:52

Python 3 + requests, 150 143 bytes

(__import__("requests").get("http://api.stackexchange.com/questions/111115?site=codegolf").json()['items'][0][k]for k in('score','view_count'))


7 bytes shorter thanks to notjagan.

Output: [4, 270]

• Good job! :) +1 – HyperNeutrino Mar 3 '17 at 20:54
• -7 bytes with [__import__("requests").get("http://api.stackexchange.com/questions/111115?site=codegolf").json()['items'][0][k]for k in('score','view_count')]. – notjagan Mar 3 '17 at 22:05
• @notjagan I edited it, but I'm not sure it's correct. Is an expression a valid output? – L3viathan Mar 3 '17 at 22:40
• A generator function as output is allowed. meta.codegolf.stackexchange.com/a/10753/34718 – mbomb007 Mar 3 '17 at 22:44
• @mbomb007 Good point, editing it now. – L3viathan Mar 3 '17 at 22:45

Powershell, 119 Bytes

,"-po.+?>(.+?)<","(\d+) times<"|%{[Regex]::Match((irm codegolf.stackexchange.com/questions/111115),\$_).Groups[1].Value}


Outputs like

Shortest regex I could get to match exactly the vote count and nothing else, could make it shorter but then you would need to use Matches instead of Match

irm is short for Invoke-RestMethod and returns the raw page as text, then we just regex match the line

<span itemprop="upvoteCount" class="vote-count-post " title="View upvote and downvote totals" style="cursor: pointer;">4</span>


by looking for -po in count-post, up to the next >, then everything between that and the next < is captured and retrieved.

using basic request web parsing in powershell requires calls to things like getElementsByClassName which aren't very golf friendly, so the irm method seems to be shortest.

• This isn't quite valid because it's missing the views. Additionally, could you add a link to an online Powershell emulator (I can't find one) or attach an animated image of you running your program? Thanks! – HyperNeutrino Feb 24 '17 at 14:06
• @HyperNeutrino Powershell is standard on any windows Machine, I've put an image in showing the results though. – colsw Feb 24 '17 at 14:28
• Yes, but I use Linux. :P – HyperNeutrino Feb 24 '17 at 14:28
• Alright, appears to work now! +1 – HyperNeutrino Feb 26 '17 at 4:58