Created
July 5, 2021 14:32
-
-
Save RobbiNespu/d525ffd6be8d2a6d283195d0ff164fe3 to your computer and use it in GitHub Desktop.
source ~/miniconda3/etc/profile.d/conda.sh conda create --name snakes python=3.7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import feedparser | |
# nenez9595.blogspot.com/feeds/posts/default?start-index=3?max-results=500 | |
# nenez9595.blogspot.com/feeds/posts/default?n=1000 | |
# nenez9595.blogspot.com/feeds/posts/default?alt=json | |
rss_url = "https://nenez9595.blogspot.com/feeds/posts/default?max-results=500" | |
#NewsFeed = feedparser.parse(rss_url) | |
#entry = NewsFeed.entries[1] | |
#print(entry.keys()) | |
feed = feedparser.parse( rss_url ) | |
items = feed["items"] | |
for item in items: | |
#print(item) | |
time = item[ "published_parsed" ] | |
title = item[ "title" ] | |
slug = item[ "title" ].replace(' ', '-').lower() | |
year = str(time.tm_year) | |
mon = str(time.tm_mon) | |
day = str(time.tm_mday) | |
clock= item[ "updated" ] | |
#print("Time:"+year + '-' + mon + '-' + day) | |
#print("Title:"+title) | |
link = item[ "link" ] | |
print("Link - "+link) | |
fileName = year + '-' + mon + '-' + day + '-' + slug + '.md' | |
fileName = fileName.replace('/', '') | |
f = open(fileName,'w') | |
value = item["content"][0]['value'] | |
f.write('---\nlayout: post\ntitle: ' + title + '\n') | |
f.write('---\ndate: ' + clock + '\n') | |
f.write('draft: false\ntype: post\n') | |
f.write('---\n') | |
f.write('{{< rawhtml >}}') # my custom hugo shortcode | |
f.write(value) | |
f.write('{{</ rawhtml >}}') # my custom hugo shortcode | |
print('end') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment