File tree Expand file tree Collapse file tree 3 files changed +174
-145
lines changed
Chapter4_TheGreatestTheoremNeverTold Expand file tree Collapse file tree 3 files changed +174
-145
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change
1
+ import sys
2
+
1
3
import numpy as np
2
4
from IPython .core .display import Image
3
5
4
-
5
6
import praw
6
7
7
8
8
9
reddit = praw .Reddit ("BayesianMethodsForHackers" )
9
10
subreddit = reddit .get_subreddit ( "pics" )
10
11
11
12
top_submissions = subreddit .get_top ()
12
- top_submission = top_submissions .next ()
13
- while "i.imgur.com" not in top_submission .url :
14
- #make sure it is linking to an image, not a webpage.
13
+
14
+
15
+ n_pic = int ( sys .argv [1 ] ) if sys .argv [1 ] else 1
16
+
17
+ i = 0
18
+ while i < n_pic :
15
19
top_submission = top_submissions .next ()
20
+ while "i.imgur.com" not in top_submission .url :
21
+ #make sure it is linking to an image, not a webpage.
22
+ top_submission = top_submissions .next ()
23
+ i += 1
16
24
17
25
print "Title of submission: \n " , top_submission .title
18
26
top_post_url = top_submission .url
34
42
35
43
votes = np .array ( [ upvotes , downvotes ] ).T
36
44
45
+
46
+
47
+
37
48
38
49
39
50
You can’t perform that action at this time.
0 commit comments