-
Notifications
You must be signed in to change notification settings - Fork 1
/
CS490.py
35 lines (20 loc) · 881 Bytes
/
CS490.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import feedparser
from os import environ
import Crowbars
class CS490:
name = "CS 490"
videos = {}
def __init__(self):
feed_data1 = feedparser.parse(environ["PANOPTOSYNC_CS490A_FEED"])
feed_data2 = feedparser.parse(environ["PANOPTOSYNC_CS490B_FEED"])
self.videos = feed_data1.entries + feed_data2.entries
self.videos = sorted(self.videos, key = lambda video: video["title"])
self.videos = sorted(self.videos, key = lambda video: video["published_parsed"])
counter = 0
for i, video in enumerate(self.videos):
counter = counter + 1
title = video["title"]
title = Crowbars.remove_prefix(title, "CS 490: ")
title = Crowbars.remove_prefix(title, "CS490")
title = title.strip()
self.videos[i]["title"] = str(counter) + " - " + title