Skip to content

Commit

Permalink
Added BeautifulSoup as a submodule.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdoms committed Apr 24, 2011
1 parent 19e2bb0 commit 38771ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "beautifulsoup"]
path = beautifulsoup
url = git@github.com:bdoms/beautifulsoup.git
1 change: 1 addition & 0 deletions beautifulsoup
Submodule beautifulsoup added at 045890
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ can specify via the command line:

python tumblr_backup.py --csv=true account_name

Note that private accounts requiring authorization are not currently supported.

7 changes: 6 additions & 1 deletion tumblr_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import urllib2
import csv

# add BeautifulSoup submobule to path
lib_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'beautifulsoup')
sys.path.append(lib_dir)

# extra required packages (StoneSoup is the version for XML)
from BeautifulSoup import BeautifulStoneSoup

Expand Down Expand Up @@ -115,7 +119,7 @@ def savePost(post, save_folder, header="", use_csv=False, save_file=None):


def backup(account, use_csv=False):
""" makes HTML files for every post on a public Tumblr blog account """
""" make an HTML file for each post or a single CSV file for all posts on a public Tumblr blog account """

if use_csv:
print "CSV mode activated."
Expand Down Expand Up @@ -169,6 +173,7 @@ def backup(account, use_csv=False):

posts = soup.findAll("post")
for post in posts:
print post
if use_csv:
savePost(post, save_folder, use_csv=use_csv, save_file=save_file)
else:
Expand Down

0 comments on commit 38771ff

Please sign in to comment.