MarkDownload - Markdown Web Clipper

I purchased the Safari extension from Mac App Store. It really fills the gap in my current workflow. Thanks for this great work!

1 Like

@death.au

I thought the expansion wasn’t available for purchased at Mac App Store yet.

Am I missing something? I can’t wait to have this extension.

Looks like it’s here!

Is there a way to set a keyboard shortcut for the right click menu options?

Mainly the Download Tab as Markdown option?
I just like the idea of being able to do this with a single shortcut, rather than having to either right click and select the option or activate the toolbar and select download.

1 Like

Sweet!

I realise this is a year later.

If you are on MacOS you could use Automator to move it.

2 Likes

I made a linked folder (alias) of Obsidian subfolder and moved it to Download folder, plugin on Firefox supports choosing location inside Downloads folder, I chose the alias folder :slight_smile:

3 Likes

That’s such a nicer solution. :face_with_hand_over_mouth:

1 Like

Downloading images now fails for me. Does anyone have the same problem?

I’ve made a python script that tags the downloads according to their content, and then moves some of them to a particular Obsidian vault because I have to write something on them every Tuesday morning

1 Like

That sounds awesome! Do share the script when you feel like it.

It will need a bit of cleaning up because my tagging system is rather idiosyncratic, and reflects the subjects I write about, but, yes. I’ll post a version. The central trick, where it tags from keywords, I stole from a clipper for the pinboard.in bookmark manager.



import re,os.path
from datetime import datetime as dt
from datetime import timedelta 
from pathlib import Path, PurePath


# TODO possibly replace print statements with logging to a file now that stuff more or less works
# TODO possibly confine operations to metadata
# TODO test the urlcleaner
# TODO (possibly really hard) write and test the byline cleaner


# These need to be adjusted for the mac, which is why they are in this form
Markdowndir="${YOURMARKDOWNDIR}"
ObsidianDir="${YOURCLIPSTOWRITEABOUTVAULT}"

md=Path(Markdowndir)
# obsidiandir is date-dependent, which is why it is not declared at the top of the file — see next function



d=dt.now()

def nextTuesday(d):
	'''returns a string, not a date object'''
	while d.weekday()!=1:
		d += timedelta(1)
	return d.isoformat()[:10]



def addMyTags(filename,isPC):
	'''returns a list of tagging strings for use in metadata'''
	bigstring=filename
	foundtaglist=['isTagged']
	if isPC:
		foundtaglist.append('Press_Column')
	triggerwords={
			"javascript|js|python|android|github": ['nerd'],
			'Pope|Cardinal|Francis|Vatican': ['Press_Column', 'Catholic', 'Schism'],
			'Bishop|Archbishop|Church|Vicar|Priest|Christian|Cathedral': ['Press_Column', 'Christianity'],
			"Trump": ['Politics', 'USA', 'neofash'],
			'Islam"Fatwa|Muslim|mosque': ['Press_Column','Islam', 'religion', 'Race/Immigrants'],
			'Online|youtube|twitter|facebook|troll|Google': ['culture_of_online_life','Adtech','security','privacy','journalism'],
			'dn.se|expressen|svd.se|ö|ä|å|Sverige|Svenska': ['Sweden', 'Swedish'],
			'Akademien|Engdahl|Frostenson|Arnault': ['Akademien','Nobel'],
			"github": ['techie'],
			'machine learning|GPT-3': ['AI'],
			'asylsökande|ensamkommande|migrants': ['Race/Immigrants'],
			"transphobic|transphobia|gender": ["terf"] 
		}
	for k,v in triggerwords.items():
		if re.search(k,bigstring,re.I):
			foundtaglist.extend(v) 
	return sorted(set(foundtaglist)) # set eliminates duplicates; sorted returns a fresh list

# this is not yet written
def cleanauthorfield():
	pass

# this is not yet called
def cleansourceURL(metadata):
	messyUrl=re.search("https?\w+",metadata)
	return messyUrl.group.split('?',1)


def GetCurrentPressColumndir():
	''' returns a Path object representing next Tuesday's subdirectory'''
	targetdir=os.path.join(ObsidianDir,nextTuesday(d))
	td=Path(targetdir)
#	print(td)
	if not td.exists():
		td.mkdir()
	return td

def MoveFileToObsidian(filetomove):
	td=GetCurrentPressColumndir()
	movedName=td.joinpath(filetomove)
	files.rename(movedName)
	print("File moved to {}".format(movedName))

def cleanTags(tagstring):
	''' takes a string of variously separated tags and returns a comma-separated list of strings'''
	taglist=tagstring[1:-1].split(',') # to get rid of the brackets
	tagstring=" ".join(taglist) # to get rid of commas
	taglist=tagstring.split()
	print("Taglist is now {}".format(taglist))
	return taglist

def MoveToPressColumn():
	pass


mydir=md.iterdir()
for files in mydir:
	if files.is_file():
		f=open(files,mode='r',encoding='utf8')
		bigstring=f.read()
		filename=f.name
		f.close()
		l=bigstring.splitlines()
		if "isTagged" in bigstring:
			print("{} has been tagged already; ignoring".format(files.name))
			continue
		try:
			metadata=bigstring.split('---')[1] # this is a placeholder for the clean* stubs above to operate on
		except IndexError: # there may be no metadata block
			continue
		isPressClip=False
		print("\n\n\nProcessing {}".format(files.name))
		for t in l:
			if re.match("tags: ",t):
				print("Tagging {} ".format(files.name))
				tagstring=(t[6:])
				taglist= cleanTags(tagstring)
				# so taglist is now a comma-separated list of strings, whether or not originally space separated.
					# parsing whole file stuff goes here
				if "Press_Column" in taglist:
					isPressClip=True
					mytags=addMyTags(bigstring,True)
				else:
					mytags=addMyTags(bigstring,False)
				if mytags:
					if "Press_Column" in mytags:
						isPressClip=True #(did the autotagger find a press column subject?)
#					print("addMyTags returned: {}".format(mytags))
					properlyTaggedString=bigstring.replace(tagstring,', '.join(mytags))# this would be where to add hashmarks for tags
					f=open(files,mode='w',encoding='utf8')
					f.write(properlyTaggedString)
					f.close()
					if isPressClip:
						MoveFileToObsidian(files.name)
				else:
					print("Nothing changed in this file by me: original tags were ...") 
					print(','.join(taglist)) # see notes below
				break
		if not taglist and not mytags:
			print("No tags at all found in {}".format(files.name))



			# Clean up the author field in the metadata(factored out into a routine)
			# Clean up the source URLs, by deleting everything after the question mark
			# clean up the bylines, keeping only the first line — needs to be in a routine of its own

Extremely clunky coding style no doubt. I write so I can still understand it two years (or two weeks) after I have first got it working.

2 Likes

That’s really something I will explore more. Love the topics as well. :wink: Thanks for sharing!

Love that solution – so elegant! Thanks for bringing this idea here. Great discussion, so many insightful post. :smile:

For some reason a MacOS alias didn’t work for me and Firefox reported a failed download.
That said, a symlinked folder worked just fine. Thanks for the idea.

Every time I download with this plugin it fails to download images. Any idea what this is happening for me?

I usually had failed download when I changed name of linked folder in Obsidian, the alias became broken and it fails

My settings (images aren’t download, I had links to images in notes)
image

1 Like

I have used this extension a long time ago with no problem. Now It shows downloading the files but all the image downloads fail. I guess it should be a kind of bug.

what do you think folks?