python - Reddit Praw Api usage to search submissions -


basic code:

import praw r = praw.reddit(user_agent='getting data!!') r.login("username","password",disable_warning=true) results=r.search('whatever', subreddit=none, sort=none, syntax=none, period=none) x in results:     print x 

i wish write code submissions , comments related. submissions should constrained search query , time period.

the problems face that:

a. can't understand how specify period in above, documentation tend poor

b. don't know if result constrained limit. above code yields:

923 :: reddit, type whatever on mind no matter how insignificant... 5598 :: google maps should have "on way" feature find conve... 3961 :: lpt: if you're overheating whatever reason, run wrists under... 1556 :: lad, whenever mother wanted me , play... 5085 :: "the entire state offline in there fix whatever t... 1259 :: heyy, webcomic "subnormality," artwork cracke... 604 :: iama professional youtuber.  whatever means... ama you'd 1156 :: [spoiler] whatever happened g2 vs strix it's absolute joke 1217 :: yesterday ate whatever wanted , learned 1291 :: lpt: set plugins (flash, etc.) activated cl... 1544 :: whatever do, don't step on duck. 1301 :: diner in vegas called "roulette burger" each booth has roul... 649 :: been trying establish basic wardrobe. not preppy ... 1141 :: mods no longer give shit, post whatever : new wow expansion doesn't... 549 :: whatever happened chatrooms? 212 :: iama graphic designer spend 5 mins on whatever want. 673 :: ama. hi there, i'm david ury, played spooge in season 2. please ask ... 0 :: "whatever they're going blame on osama bin laden... don't be... 3 :: dinner time! 1/4/15 or 4/1/15 (whatever works) 536 :: friendly reminder: if you've been given gold, it's within yo... 378 :: kp, keratosis pillaris, "chicken skin" - whatever call it, please ... 637 :: [wp]what if lived in world whatever did other people... 1053 :: instead of gym, have place people can go build wood pallets... 69 :: pick whatever want giveaway! 408 :: reminder newbies. don't have buy whole bitcoin ... 

i highly doubt there must many more this. if yes, how can them. if requests constrained time-window. there workaround sleep , more?

c. don't know if constraints twitter on not accessing historcial data. though period argument states opposite. still not certain.

d.it returns generator. how can access full submission text , related comments' text well.

sorry if seems bit indirect, dearth of examples online , lack of proper documentation has led face these issues.

a: it's looking '3 months ago'. (you can see information api documentation. has one of (hour, day, week, month, year, all).

b: constrained limit, return 1000 results max. there might ways around that, i'm not sure of are, or how easy are.

c: kind of answer b, guess.

d: you're looking properties of submission, access attributes (e.g. object.attribute). can see full list of attributes submissions on this page.

so if wanted access self text goes link, you'd have like:

for x in results:     print x.selftext 

if want comments, though, not part of object. you'd need submission id , query submission comments.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -