simplified markdown conversion
This commit is contained in:
parent
1e00605d18
commit
d71af2078a
61
main.py
61
main.py
|
@ -121,67 +121,6 @@ if markdown:
|
|||
mdfile.new_table_of_contents(table_title='Contents', depth=2)
|
||||
mdfile.create_md_file()
|
||||
|
||||
if not markdown:
|
||||
mdfile = MdUtils(file_name=title,title='Daily Dose')
|
||||
mdfile.new_line('\n')
|
||||
for feed in rss_feeds:
|
||||
Ignore = []
|
||||
ReadSummary = True
|
||||
URL = None
|
||||
ToRead = 5
|
||||
try:
|
||||
URL = feeds[feed]["URL"]
|
||||
except KeyError:
|
||||
print("Improper configuration for %s. No URL Specified")
|
||||
exit(1)
|
||||
try:
|
||||
Ignore = eval(feeds[feed]["IGNORE"])
|
||||
except KeyError:
|
||||
None
|
||||
try:
|
||||
ReadSummary = eval(feeds[feed]["SUMMARY"])
|
||||
except KeyError:
|
||||
ReadSummary = True
|
||||
try:
|
||||
ToRead = eval(feeds[feed]["ToRead"])
|
||||
except:
|
||||
None
|
||||
|
||||
rss = feedparser.parse(URL)
|
||||
maximum = len(rss.entries)
|
||||
|
||||
count = 0
|
||||
|
||||
if ToRead == -1:
|
||||
ToRead = maximum
|
||||
|
||||
#print("## From %s:" % feed,end="\n\n")
|
||||
mdfile.new_header(level=1, title="From %s" % feed)
|
||||
|
||||
while count != ToRead:
|
||||
NoSkip = True
|
||||
Title = rss.entries[count].title
|
||||
summary = rss.entries[count].summary
|
||||
for words in Ignore:
|
||||
if (words.lower() in Title.lower()) or (words.lower() in summary.lower()):
|
||||
NoSkip = False
|
||||
break
|
||||
if NoSkip:
|
||||
#print(title)
|
||||
mdfile.write(str("* **"+Title+"**"))
|
||||
if ReadSummary:
|
||||
#print(summary)
|
||||
mdfile.write(" - ")
|
||||
mdfile.write(summary)
|
||||
mdfile.write("\n\n")
|
||||
else:
|
||||
mdfile.write("\n")
|
||||
|
||||
count += 1
|
||||
mdfile.new_line('\n')
|
||||
mdfile.new_table_of_contents(table_title='Contents', depth=2)
|
||||
mdfile.create_md_file()
|
||||
|
||||
|
||||
import pypandoc
|
||||
|
||||
|
|
Loading…
Reference in New Issue