python 2.7 - Get URL file property from a Windows internet shortcut (.url) file -
i want retrieve url property of windows internet shortcut (.url) file. example, there youtube trailer "rogue one: star wars story trailer (2016)" @ https://www.youtube.com/watch?v=ze2kpozx_ku. if url dragged chrome browser windows desktop file "rogue one- star wars story trailer (2016) - youtube.url" created. in windows 10 can @ file's property (e.g. right click , select 'property'), select 'web document' tab, , in url field there "https://www.youtube.com/watch?v=ze2kpozx_ku". how url programmtically in python 2.7?
i chasing problem wrong way! thought needed extract file information. using philip's suggestion printed contents , saw url inside. example, dragging movie's url c:\temp , running following got url:
filename = 'c:\temp\rogue one- star wars story trailer (2016) - youtube.url' open(filename, "r") infile: line in infile: if (line.startswith('url')): url = line[4:] break print url
this gives: https://www.youtube.com/watch?v=ze2kpozx_ku
Comments
Post a Comment