Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Story
How we grew from 0 to 3 million users
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Parsing Reddit comments - Python Reddit API Wrapper (PRAW) tutorial p.2

28.0K views
•
August 7, 2017
by
sentdex
YouTube video player
Parsing Reddit comments - Python Reddit API Wrapper (PRAW) tutorial p.2

TL;DR

This tutorial focuses on parsing comments in the Python Reddit API Wrapper (PRAW) and discusses challenges related to the hierarchical structure of comments.

Transcript

what's going on everybody welcome to part two of the Python reddit API wrapper or prawn tutorial mini-series in this tutorial what were we talking about is at least beginning to parse comments so like I said but at the end of the last video comments represent a different kind of challenge for a variety of reasons mainly it's just the fact that comm... Read More

Key Insights

  • 💬 Parsing comments in PRAW involves iterating through the comment objects and accessing their attributes.
  • 💬 Nested comments and replies need to be handled separately using conditional statements.
  • 👪 Rebuilding the comment tree can be done using dictionaries to store the parent ID, parent content, and replies.
  • 💬 The "replace_more" method is useful for handling long comment chains and preventing errors.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is the main topic of this tutorial?

The main topic of this tutorial is parsing comments in the Python Reddit API Wrapper (PRAW).

Q: Why are comments challenging to parse?

Comments are challenging because they have a hierarchical structure and are not perfectly ordered.

Q: How can you access the comments in PRAW?

You can access the comments by using the "submission.comments" attribute.

Q: How can you handle nested comments and their replies?

To handle nested comments and their replies, you can iterate through the comments and use the "replies" attribute of each comment object.

Q: What is the purpose of using the "dot list" method?

Using the "dot list" method converts the comments into a list format and allows for easier iteration.

Q: How can you prevent errors when iterating through long comment chains?

You can use the "replace_more(limit=0)" method to replace instances of "more comments" and continue iterating through the comments.

Q: How can you rebuild the comment tree?

You can rebuild the comment tree by creating a dictionary structure with the parent ID, parent content, and all replies for each comment.

Summary & Key Takeaways

  • The tutorial covers the process of parsing comments in PRAW and the challenges they present due to their hierarchical structure.

  • The code demonstrates how to iterate through comments and print their ID and body.

  • It discusses the need to handle replies and the limitations of the API in retrieving nested comments.

  • The tutorial suggests a method to rebuild comment trees using dictionaries.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from sentdex 📚

Python Generator Functions for massive Performance Improvements with Lists thumbnail
Python Generator Functions for massive Performance Improvements with Lists
sentdex
How to Train a Chatbot Using TensorFlow and Python thumbnail
How to Train a Chatbot Using TensorFlow and Python
sentdex
Parsing XML - Go Lang Practical Programming Tutorial p.11 thumbnail
Parsing XML - Go Lang Practical Programming Tutorial p.11
sentdex
Python: How to Program the Chaikin Money Flow Trading Indicator thumbnail
Python: How to Program the Chaikin Money Flow Trading Indicator
sentdex
How to Parse Twitter Data Using Python Effectively thumbnail
How to Parse Twitter Data Using Python Effectively
sentdex
Python: How to Graph the Chaikin Money Flow Trading Indicator in Matplotlib thumbnail
Python: How to Graph the Chaikin Money Flow Trading Indicator in Matplotlib
sentdex

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots
  • Open Graph Checker

Company

  • About us
  • Our Story
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.