I'm using praw the Reddit developer extension to take the title from a certain subreddit. I want to only take the title if the url the post directs to ends in .tv.
How to extract specific URLs that contain the top-level domain .tv and append them to their own list?
import praw
reddit = praw.Reddit(client_id='', client_secret='', user_agent='')
hot_p = reddit.subreddit('music').top('week')
for post in hot_p:
# if post.url ends in .tv...
raw_titles.append(post.title)
raw_url.append(post.url)