Skip to content

Commit

Permalink
Add Delete Donwloaded Data Argument
Browse files Browse the repository at this point in the history
  • Loading branch information
anudit committed Jan 2, 2019
1 parent 8c56b7f commit 1e74e23
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
## Usage
Use `python m2m.py` to convert any medium article to Markdown.

| Arguments | Meaning | Usage |
|:-------------:|:-----------------------:|:----------------------:|
| -y |Say Yes to All Questions |`python m2m.py -y` |
| -o |Complete Offline Mode |`python m2m.py -o` |
| Arguments | Description | Usage |
|:-------------:|:-----------------------------:|:----------------------:|
| -y |Say Yes to All Questions |`python m2m.py -y` |
| -o |Complete Offline Mode |`python m2m.py -o` |
| -d |Delete All Downloaded Articles |`python m2m.py -d -y` |

## Tested Links

Expand Down
18 changes: 18 additions & 0 deletions m2m.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import urllib
import argparse
import time
import shutil

def parseArticle(soup):
sec = soup.find_all("div", "section-inner")
Expand Down Expand Up @@ -129,12 +130,29 @@ def parseArticle(soup):
parser = argparse.ArgumentParser()
parser.add_argument('-y', action='store_true')
parser.add_argument('-o', action='store_true')
parser.add_argument('-d', action='store_true')
options = parser.parse_args()

if(options.y == True):
FORCECONTINUE = True
if(options.o == True):
OFFLINEMODE = True
if(options.d == True):
if(FORCECONTINUE):
print("Deleting...")
shutil.rmtree("./" + FOLDERNAME+"/")
print("Done.")
exit()
else:
ans = input("Delete All Donwloaded Articles ? (Y/N) : ")
if (ans.lower() != "y"):
exit()
else:
print("Deleting...")
shutil.rmtree("./" + FOLDERNAME+"/")
print("Done.")
exit()


LINK = input("Medium Article Link : ")

Expand Down

0 comments on commit 1e74e23

Please sign in to comment.