-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renaming files to make it clearer. creating subdirectory and ignoring it
- Loading branch information
1 parent
8a515b7
commit 083fd51
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import downloader.medium as medium | ||
import downloader.main as downloader | ||
import argparse | ||
import os | ||
|
||
parser = argparse.ArgumentParser(prog='run.py', description="Script to convert medium posts to markdown files") | ||
parser.add_argument('-u', metavar='USER', help="username", required=True, type=str) | ||
parser.add_argument('-l', metavar='LIMIT', help="Number of posts to retrieve. Integer, and the default is 10 by Medium. Zero will be swapped to one.", type=int) | ||
args = parser.parse_args() | ||
|
||
postIDs = medium.get_latest_post_ids(args.u, args.l) | ||
print(postIDs) | ||
# creating subdirectory | ||
|
||
medium_post_dir_markdown = "medium_posts_markdown" | ||
|
||
if not os.path.exists(medium_post_dir_markdown): | ||
os.makedirs(medium_post_dir_markdown) | ||
|
||
post_ids = downloader.get_latest_post_ids(args.u, args.l) | ||
html_posts = downloader.download_posts_in_html(args.u, post_ids) |