Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhupesh-V committed Apr 13, 2020
1 parent 351ba31 commit 7a5177f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ jobs:
- name: Self test
id: selftest

# Put your action repo here
uses: Bhupesh-V/memer-action@master
with:
filter: "new"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Lint
run: |
pip install flake8
flake8 main.py
flake8 main.py --ignore=E501
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: "Memer Action"
description: "A GitHub Action for Programmer Memes"
author: "Bhupesh Varshney"
inputs:
filter:
description: "Sort posts on reddit by (hot, new, top & rising) by default hot"
required: false
outputs:
title:
description: "The Post Title"
source:
description: "The Source of the meme"
meme:
description: "The meme image"
description: "The Meme Image"
runs:
using: "docker"
image: "Dockerfile"
Expand Down
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ def getMeme(filter_posts="hot"):
memedict = {}
f = feedparser.parse(f"{HOST_URL}/{filter_posts}.rss")
for entry in f.entries:
x = entry['content'][0]['value']
img = x[x.find("https://i.redd.it"): x.find("link") - 3]
post_content = entry["content"][0]["value"]
img = post_content[
post_content.find("https://i.redd.it"): post_content.find("link") - 3
]
if img != "":
memedict["title"] = entry["title"]
memedict["src"] = str(entry["link"])
Expand Down

0 comments on commit 7a5177f

Please sign in to comment.