Skip to content

kxsong/hackru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

About:
A Reddit bot that detects certain types of Youtube reposts in a given subreddit.

Reddit has a rudimentary method of detecting duplicate submissions. It takes the submission URL, then strips the leading "www" and any anchor ("index.html#anchor") at the end. For some web content, this system works well. However, there is more than one URL that can reach a Youtube video. The following links will show the same video:

http://www.youtube.com/watch?v=uRGljemfwUE (basic link)
http://youtu.be/uRGljemfwUE (shortened link)
http://www.youtube.com/watch?v=uRGljemfwUE&feature=youtu.be (what the shortened link redirects to)
http://www.youtube.com/watch?v=uRGljemfwUE&list=FLrzKKs_p0amTiGyFvNYxIrw&index=54&feature=plpp_video (a link from a playlist)
http://www.youtube.com/watch?v=uRGljemfwUE&foo=bar&bar=foo&abc=123 (any extra key/value pairs) 

yt_repost will detect youtube submissions of any form, and look for duplicates of the first three forms. It then posts a comment listing the duplicates.

Usage: python yt_repost.py subreddit [last_ID]
	create a username/password file at ~/username.txt. It should have two lines: the first being the screenname, the second being the password

Requirements:
	Python requests: http://pypi.python.org/pypi/requests

ideas for improvements: 
	use reddit api wrapper: https://github.com/mellort/reddit_api
	a more secure way of storing username+password
	use http://www.reddit.com/domain/youtube.com/new/ and http://www.reddit.com/domain/youtu.be/new/
		This is more comprehensive, but not all moderators may want the bot on their subreddit. Also, subreddits that the bot is not a moderator of may rate-limit the bot's comments until it gets more upvotes.
	show timestamps of duplicate posts
	keep statistics on the frequency of different kinds of youtube URLs 
	
compatible with python 2.6.6

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published