Skip to content

Commit

Permalink
Install a linter
Browse files Browse the repository at this point in the history
This would have caught my mistake in 0d6d0a1, and makes sure the code looks pretty!
  • Loading branch information
RealOrangeOne committed Jul 20, 2021
1 parent 2f5cd06 commit 1321bd2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
with:
python-version: 3.9
- name: Install dependencies
run: pip install -r requirements.txt
run: pip install -r dev-requirements.txt
- name: Lint scraper
run: flake8 scrape.py
- name: Scrape data
run: python3 scrape.py
- name: Build site
Expand Down
3 changes: 3 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-r requirements.txt

flake8==3.9.2
8 changes: 3 additions & 5 deletions scrape.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import concurrent.futures
import os
import shutil
import html2text

import requests
Expand Down Expand Up @@ -35,6 +34,7 @@ def get_duration(seconds):
minutes, seconds = divmod(seconds, 60)
return f"{minutes} mins {seconds} secs"


def create_episode(api_episode, base_url, output_dir):
# RANT: What kind of API doesn't give the episode number?!
episode_number = int(api_episode["url"].split("/")[-1])
Expand Down Expand Up @@ -71,10 +71,7 @@ def create_episode(api_episode, base_url, output_dir):
{"name": link.get("title"), "link": base_url + link.get("href")}
)

try:
player_embed = page_soup.find("input", class_="copy-share-embed").get("value")
except:
player_embed = None
player_embed = page_soup.find("input", class_="copy-share-embed").get("value")

show_attachment = api_episode["attachments"][0]

Expand Down Expand Up @@ -122,5 +119,6 @@ def main():
for future in concurrent.futures.as_completed(futures):
future.result()


if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
extend_ignore=E128,E501

0 comments on commit 1321bd2

Please sign in to comment.