reddit

Post to Reddit via URL

 ̄綄美尐妖づ 提交于 2019-12-03 11:08:20
Is it possible to post a link to Reddit via URL? For example for Facebook you can do <a href="https://www.facebook.com/sharer/sharer.php?u=http://stackoverflow.com"> Share Stackoverflow on your profile! </a> Does Reddit have an equivalent endpoint I can hit to share a URL? Bill the Lizard There are several ways to do this, depending on exactly what kind of application you have. If you're making something interactive, you can take a user to the submit page with a URL and title already filled in. The following URL will open the reddit submit form with a link to this question: http://www.reddit

Get all comments from a specific reddit thread in python

我的梦境 提交于 2019-12-03 06:47:42
The official way, r = praw.Reddit('Comment Scraper 1.0 by u/_Daimon_ see ' 'https://praw.readthedocs.org/en/latest/' 'pages/comment_parsing.html') submission = r.get_submission(submission_id='11v36o') submission.replace_more_comments(limit=None, threshold=0) is extremely slow. Is there a way to speed this up? There are people that have extracted every reddit comment into a database, so there must be some way to do this quicker. Phylliida Edit: the new praw api (6.0.0) has lists() which make the job easier: This also handles AttributeError that might occure due to more_comments through the use

reddit style voting with django

风格不统一 提交于 2019-12-03 05:20:22
问题 Hay i need to hand implemeneting a voting system into a model. I've had a huge helping hand from Mike DeSimone making this work in the first place, but i need to expand upon his work. Here is my current code View def show_game(request): game = Game.objects.get(pk=1) discussions = game.gamediscussion_set.filter(reply_to=None) d = { 'game':game, 'discussions':discussions } return render_to_response('show_game', d) Template <ul> {% for discussion in discussions %} {{ discussion.html }} {% endfor

urllib2 HTTP error 429

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I have a list of sub-reddits and I'm using urllib to open them. As I go through them eventually urllib fails with: urllib2.HTTPError: HTTP Error 429: Unknown Doing some research I found that reddit limits the ammount of requests to their servers by IP: Make no more than one request every two seconds. There's some allowance for bursts of requests, but keep it sane. In general, keep it to no more than 30 requests in a minute. So I figured I'd use time.sleep() to limit my requests to one page each 10 seconds. This ends up failing just as

PHP redirection page based on GET variables

匿名 (未验证) 提交于 2019-12-03 02:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am new to PHP, so please bear with me in this elementary level question. I want to create a script that redirects the user to various addresses based on the GET variable. for example, redirection.php?id=youtube should redirect them to www.youtube.com , redirection.php?id=twitter should redirect them to www.twitter.com , and so on. Here is my code: <!DOCTYPE html> <html> <head> <title>Please Wait...</title> </head> <body> <?php // directs the user to various locations on the internet print_r($_GET); if($_GET['id'] === 'youtube') { header(

Installing PRAW

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to install PRAW so I can make reddit bots and stuff, but all the install guides are confusing to me so could someone explain how to as noob friendly as possible. I've had some experience with vanilla python. Thanks! 回答1: praw is best installed, according to the documentation , via pip . To install pip , you need setuptools . Here is a simple guide on installing pip via setuptools. Basically, download ez_setup.py and get-pip.py , two Python scripts that automatically get and install setuptools and pip . You'll want to run the

find all two word phrases that appear in more than one row in a dataset

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We would like to run a query that returns two word phrases that appear in more than one row. So for e.g. take the string "Data Ninja". Since it appears in more than one row in our dataset, the query should return that. The query should find all such phrases from all the rows in our dataset, by querying for two adjacent word combination (forming a phrase) in the rows that are in the dataset. These two adjacent word combinations should come from the dataset we loaded into BigQuery How can we write this query in Google BigQuery? The dataset is

How to get access token? (Reddit API)

末鹿安然 提交于 2019-12-03 00:37:09
I wonder if it is possible to get a permanent access token for personal use on Reddit? It will only be me using the App. For users, the access token expires after 1 hour. My using the below information that I have about my client-id and secret, I put up a start attempt of trying to get an access token. (MessageBox show " Error 401 ") If a user will get a token, one have to click "Allow" in the browser. Very well described here. https://github.com/reddit/reddit/wiki/OAuth2 This it NOT what I am after. I am after for, personal use, an access token only through code. Is this possible? String

reddit style voting with django

喜你入骨 提交于 2019-12-02 18:37:57
Hay i need to hand implemeneting a voting system into a model. I've had a huge helping hand from Mike DeSimone making this work in the first place, but i need to expand upon his work. Here is my current code View def show_game(request): game = Game.objects.get(pk=1) discussions = game.gamediscussion_set.filter(reply_to=None) d = { 'game':game, 'discussions':discussions } return render_to_response('show_game', d) Template <ul> {% for discussion in discussions %} {{ discussion.html }} {% endfor %} </ul> Model class GameDiscussion(models.Model): game = models.ForeignKey(Game) message = models

Can't access my reddit installation

我与影子孤独终老i 提交于 2019-12-02 11:43:23
问题 I install Reddit Script on my server but I can't access my installation. I try to access http://129.xxx.xx.xx (my server IP address but is has a redirection to reddit.local and here looks to load for ever. I install it using my automatic installer and after that I just populate the script with some data as per instruction provided in the bottom of the instruction document. I miss something? 回答1: You'll need to configure the hostname you used (it sounds like reddit.local ) to point to the