Skip to content

Commit

Permalink
Fix reddit album parsing. (#200)
Browse files Browse the repository at this point in the history
* Update redditelement.py

* Pin (most) requirements.

* Update requirements.txt
  • Loading branch information
shadowmoose authored Mar 28, 2021
1 parent 775463c commit bd49504
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions redditdownloader/processing/wrappers/redditelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _submission(self, post):
# This post probably doesn't have a URL, and has selftext instead.
for url in stringutil.html_elements(post.selftext_html, 'a', 'href'):
self.add_url(url)
if getattr(post, 'is_gallery', False):
if getattr(post, 'is_gallery', False) and getattr(post, 'media_metadata', False):
for k, img in post.media_metadata.items():
try:
self.add_url(img['s']['u'])
Expand All @@ -154,7 +154,7 @@ def _ps_submission(self, post):
self.num_comments = post.num_comments
self.score = post.score
self.body = html.unescape(str(post.selftext)) if 'selftext' in post and post.selftext else ''
if getattr(post, 'is_gallery', False):
if getattr(post, 'is_gallery', False) and getattr(post, 'media_metadata', False):
for k, img in post.media_metadata.items():
try:
self.add_url(html.unescape(img['s']['u']))
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ youtube_dl
imgurpython==1.1.7
requests>=2.22.0
sqlalchemy==1.3.23
praw>=7.2.0
lxml>=3.6.0
praw==7.2.0
lxml==4.6.3
newspaper3k==0.2.8
beautifulsoup4==4.7.1
colorama==0.4.1
Pillow==7.1.0
Pillow==8.1.1
pathvalidate==0.28.1
eel==0.11.1
twitter-text-python==1.1.1
Expand Down

0 comments on commit bd49504

Please sign in to comment.