Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import urllib.request
import csv
def create_articles(path):
temp = []
file = open(path, 'r')
for line in file:
arr = line.split(',')
if arr[0][-4:].lower() == '.pdf':
ext = 'pdf'
ext = 'html'
temp.append(Article(arr[0], arr[1], ext))
return temp
def save_as_html(url, title, ext):
urllib.request.urlretrieve(url, 'html/' + title + "." + ext)
print("error happend on ", url)
def main():
articles = create_articles('instapaper-export.csv')
for a in articles:
print('saving article number', articles.index(a), 'title:', a.title, 'and extention', a.ext)
save_as_html(a.url,str(articles.index(a)) + '-' + a.title, a.ext)
class Article:
def __init__(self, url, title, extention):
self.url = url
self.title = title
self.ext = extention

This comment has been minimized.

Copy link
Owner Author

@jakevossen5 jakevossen5 commented Dec 14, 2018

This simply takes the csv you get as an export from your Instapaper account and saves it as a html page or a pdf page if the url ends in .pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.